Just after 2.45pm on Monday, a huge yellow-and-green crane lorry swung off the main road that cuts through the forested hills of eastern Andalucía and beetled down a track to begin picking up the enormous, wrecked pieces of Spain’s worst rail disaster in more than a decade. Behind it rolled a support lorry and a convoy of police cars.

A few minutes’ drive away, between groves of olive and oak trees, lay the two stricken trains that had smashed into each other on Sunday night, killing at least 39 people and critically injuring at least 12 others. As investigators and Guardia Civil officers walked up and down the line by the twisted carriages, the nearby town of Adamuz was in the early stages of trying to process what had happened a few kilometres from its outskirts.

What the prime minister, Pedro Sánchez, had called “a night of deep pain for our country” had given way to a day of shock and bewilderment in this municipality of 4,000 inhabitants in Andalucía’s Córdoba province.

Part of a wrecked train at the crash site. Spain’s prime minister called it ‘a night of deep pain for our country’. Photograph: Manu Fernández/AP

Adamuz’s municipal events hall, which had been turned into an emergency response centre to which the injured passengers were ferried, told its own tale. A dozen trestle tables were neatly stacked with hundreds of blankets brought by local people. Inside and outside the hall, Guardia Civil officers mixed with local police, civil emergency workers – and dozens of journalists.

One ashen-faced officer was not sure how to sum up the events of the past few hours. “It was what it was,” he said. “And it was bad.”

Map showing the location of the crash

Others described the crash site in terms as eloquent as they were horrific. “There were moments when we had to remove the dead to get to the living,” Francisco Carmona, Córdoba’s firefighting chief, told Onda Cero radio.

Rafael Moreno, the mayor of Adamuz, said he would never forget what he had seen on the track: “People asking and begging for help. Those leaving the wreckage. Images that will always stay in my mind.”

Despite the enormity of what had happened, the one thing everyone could agree on was that the people of Adamuz had done all they could to help those who had been onboard the high-speed Iryo train travelling from Málaga to Madrid and the Renfe train from Madrid to Huelva. Some had rushed down to the tracks to help, while others had grabbed what they could and headed down to the municipal hall.

Aftermath of high-speed train crash in southern Spain – videoAftermath of high-speed train crash in southern Spain – video

A local woman called Carme said she knew something was very wrong when she heard the sirens and saw ambulances tearing through the town. Before long, local WhatsApp groups were sharing news of the diaster. “It was very scary and it was a really painful night,” she said. “I tried to help by sending my 17-year-old son down to the hall with some blankets and a dressing gown.”

José María Mendoza, a 75-year-old “born and bred” in Adamuz, said he and his neighbours had never lived through anything remotely comparable with Sunday night. Standing on the pavement near the municipal hall, he said people were still struggling to accept what he called “an awful tragedy”.

“It was a bad, bad, bad night,” he said. “But the whole town pitched in and rallied round even though this was the first time that anything like this has ever happened round here. People came with food and blankets because it was cold and everyone did what they could.”

Local people donated blankets, which were piled up in the municipal hall, for the crash victims. Photograph: Sergio R Moreno/GTRES/Shutterstock

As the crane lorry got to work, the helicopter that had been circling the hills rattled out of sight and Adamuz’s large, draughty hall began to empty, thoughts – and action – turned to the causes of the crash and to the process of identifying its victims. The Guardia Civil opened five offices – in Córdoba, Málaga, Sevilla, Huelva and Madrid – where relatives of the missing could seek information and leave DNA samples.

On a street in Adamuz, Benjamín Peñas, a 50-year-old builder, took a break from a refit to reflect on the terrible events of the past 20 hours. “We all did what we could,” he said. “Some people tried to get down to the crash site but pretty soon it had all been cordoned off by the emergency services. So we all took what we could down to the hall.”

Spain’s prime minister, Pedro Sánchez (right), visiting Adamuz after the disaster on Monday. Photograph: Sergio R Moreno/GTRES/Shutterstock

Peñas himself was up until 1.30am ferrying blankets, water and medical supplies down to the hall. “Some of the people I saw there were too deep in shock to be able to take in what had happened; it just hadn’t sunk in,” he said. “But others were bruised and bleeding. It is terrible to see your town make news around the world because of something like this.”