(CNN) -- At least 12 people were killed and several others injured when they were run over by a train in a town south of Barcelona, Spain, a spokesman for Catalonia Emergency Center said Thursday.
At least 14 more were hurt, and three remained in critical condition, the spokesman said.
The accident occurred Wednesday between 11:30 p.m. and midnight local time as a group tried to cross the tracks after getting off a local train that had stopped at the town of Castelldefels, authorities said.
Many were headed to the Fiesta de San Juan, which celebrates the year's shortest night, on the beach at Castelldefels.
Castelldefels mayor, Joan Sau, said about 30 people were crossing the tracks when a Barcelona-bound express train hit them.
In an interview with Spanish radio network SER, Sau said that remodelling at the train station last October resulted in the closure of an elevated crosswalk over the tracks. However, it was replaced by an underground passageway beneath the tracks, which he said was open and in use at the time of the accident.
Spanish media reports, citing witnesses, said the underground passageway was crowded as people headed to the festivities on the nearby beach. The mayor said he could not confirm those reports.
"There are bodies that are absolutely destroyed," a witness told El Pais newspaper. "The train passed over them at full speed and the pieces of bodies are all over."
Spanish Development Minister Jose Blanco said he ordered an investigation into the accident. But initial signs pointed to "imprudence" by those who tried to cross the tracks, Blanco said.
CNN's Al Goodman contributed to this report.