One of the drivers of a train which derailed in north-western Spain killing at least 80 passengers has been put under formal investigation, court officials have said.
Security camera footage showed the Madrid to Ferrol train hurtling around a bend before flipping on to its side.
More than 160 people were hurt, at least 30 seriously, in the incident near Santiago de Compostela.
Spain will hold three days of mourning over the crash, one of its worst.
The black box of the train is now with the judge in charge of the investigation.
‘No technical problems’
At least 168 people were taken to hospital after the crash, and more than 90 are still being treated, health officials say.
There are at least 30 seriously injured, including children.
People from several nationalities are among the injured, including one Briton.
A spokeswoman for the Galicia Supreme Court said the driver, who was slightly injured in the crash, was under investigation, but it was unclear which of the train’s two drivers she was referring to and whether anyone else was subject to investigation.
The president of railway firm Renfe, Julio Gomez Pomar, was quoted by El Mundo newspaper as saying the driver, who was aged 52, had 30 years of experience with the company and had been operating trains on the line for more than a year.
He said the train in the crash had no technical problems.
“The train had passed an inspection that same morning. Those trains are inspected every 7,500km… Its maintenance record was perfect,” he told Spanish radio.
But one of the drivers who was trapped in the cab of the train after the accident is quoted as saying moments after the crash that the train had taken the curve at 190 km/h (118mph) when entering the curve despite a speed limit of 80km/h, unidentified investigation sources have told Spanish media.
If this is the case, it remains to be seen whether a systems failure or driver error was the cause, correspondents say.
Spain has invested huge amounts of money in its rail network and has a relatively good safety record, says the BBC’s Tom Burridge in Madrid.
Visiting the scene, Prime Minister Mariano Rajoy, who was born in Santiago de Compostela, expressed sadness and shock.
“Today is a very difficult day. Today we have lived through a terrible, dramatic accident, which I fear will stay with us for a long time,” he said.
“For someone from Santiago, like myself, believe me, this is the saddest Day of St James of my life.”
According to official figures, the crash is one of the worst rail disasters in Spanish history.
In 1972, a frontal train crash in Andalusia, in the south, left dozens of people dead. The figures given at the time ranged between 76 and 86.
In 1944, hundreds of people were believed to have been killed in a crash in Torre del Bierzo, in Leon province – though the official account in days of heavy censorship during the early rule of Gen Francisco Franco gave the figure as 78 killed.
‘I saw corpses’
Renfe said the train came off the tracks on a bend about 3 or 4km (2-2.5 miles) from Santiago de Compostela station at 20:41 local time (18:41 GMT) on Wednesday.
It was on the express route between the capital, Madrid, and the ship-building city of Ferrol on the Galician coast, with 218 passengers on board – in addition to an unknown number of staff and crew.
Firefighter Jaime Tizon, one of the first to reach the site of the crash, described the scene as “hell”.
“I’m coming from hell, I couldn’t tell you if the engine was on fire, or one of the carriages or what…” he told Spanish newspaper ABC after dragging the injured and bodies from the train.
One witness, Ricardo Montesco, described how the train carriages “piled on top of one another” after the train hit a curve.
“A lot of people were squashed on the bottom. We tried to squeeze out of the bottom of the wagons to get out and we realised the train was burning… I was in the second wagon and there was fire. I saw corpses,” he told Spanish Cadena Ser radio station.
The derailment happened on the eve of Santiago de Compostela’s main annual festival where thousands of Christian pilgrims were expected to flock to the city in honour of St James.
The city’s tourism board said all festivities planned for Thursday have been cancelled.