Dozens of people have been injured after a passenger train collided with a freight train near a station in the German town of Meerbusch.

The accident happened Tuesday evening at around 7:30pm on a Meerbusch-Osterath and Neuss railroad segment, when a passenger train, owned by private British operator National Express, collided with a freight train owned by Deutsche Bahn. The passenger express was on its way to Rotterdam, Netherlands.

Photos released by the Meerbusch fire department showed the passenger train derailed but still upright. A spokeswoman for Deutsche Bahn told German news outlets the cargo train was stationary when the passenger train slammed into it.

The driver of the passenger train apparently noticed the cargo train, and hit the brakes, just before rushing out of the cabin to alert passengers to leave the front part of the train to avoid injuries. Seconds later the trains collided.

“The driver noticed an obstacle on the open track and immediately initiated rapid braking. Then he left the cab and informed the passengers to move to the back of the train,” a spokesman for the National Express told BILD.

+++ EIL +++ Zugunglück #Meerbusch, laut Kreissprecher 47 Verletzte, nach jetzigem Stand aber nur sechs Schwerverletzte. Im Zug waren 155 Passagiere. pic.twitter.com/TMcLHUqHDZ — Frank Schneider (@chefreporterNRW) December 5, 2017

The rear wagons of the freight train were empty. If these had been fully loaded, the crash would have been significantly worse. Locals living close to the train track reported hearing a powerful bang so loud that the windows at their homes shook.

It took hours for rescuers to free some 155 passengers stuck in the wreck. Meerbusch firefighters began pulling out passengers from the derailed train at 9:30pm local time, after finally gaining access to one of the entrances of the wrecked cars at 9:15pm. The rescue effort was complicated by a fallen power line “which posed a risk of electric shock to persons outside the train.”

Derzeit scheint die Lage den Umständen entsprechend ruhig zu sein. Die Feuerwehr hat Kontakt zu den Personen im Zug. pic.twitter.com/LgbRhcQZD3 — Feuerwehr Meerbusch (@FWMeerbusch) December 5, 2017

Weiterhin behindert der abgerissene Fahrdraht den Zugang zum Zug. Dieser soll aber in den nächsten Minuten nach Erdung möglich sein. pic.twitter.com/s4E09ues9a — Feuerwehr Meerbusch (@FWMeerbusch) December 5, 2017

“At the beginning of the mission, the rescue workers were unable to get close enough to the train to make an accurate assessment of the injuries,” the local fire department said in a statement. “At this stage of the mission, the rescuers focused on finding more seriously injured people in the wagons.”

By 11:45pm, authorities said “all injured persons are rescued from the train.” Some 20 minutes later, the local fire department confirmed that “all people have now left the train.”

Unsere Einsatzkräfte sind im Bereich der Unfallstelle eingetroffen. Derzeit wird die Lage sondiert und mit den anderen Hilfsorganisationen koordiniert. Die Verdorgung der Personen im Zug genießt hohe Priorität. Weitere Infos folgen. Die @Fw_Kaarst ist ebenfalls im Einsatz. pic.twitter.com/eYRVjjZWkR — Feuerwehr Meerbusch (@FWMeerbusch) December 5, 2017

While there have been conflicting reports as to the number of injuries, shortly before midnight, authorities announced that 41 were slightly injured in the crash. Another three people suffered moderate injuries while three others were seriously injured in the collision. None of the injuries were considered life-threatening.

Some of those slightly injured with bruises or abrasions were treated on the spot by rescue teams. Others were sent to a nearby medical facility.

“The rescue services on the ground have the situation under control. The injured people are gradually being transferred to hospital,” the fire department tweeted.