A high-speed train derailed in northern Italy early Thursday, killing two railway workers and injuring dozens of others when the engine car detached and rammed into a railroad building, authorities said.

The state-railway Freccia Rossa – or Red Arrow – passenger train was traveling on the heavily used Milan-Bologna rail line when it went off the tracks at a speed of 180 mph (300 kph), Civil Protection chief Angelo Borrelli told state radio.

ITALIAN MAN DENIED SWISS CITIZENSHIP FOR NOT KNOWING BEARS AND WOLVES SHARED ZOO ENCLOSURE: REPORTS

It crashed around 5:30 a.m. in the countryside outside the town of Lodi while on its way to Bologna, officials said.

“The engine car derailed, detached completely and kept going,'' Girolamo Fabiano, a railroad police official told state radio. “Then the second car derailed."

The railway confirmed the two fatalities were engineers driving the train. At least 27 others were injured, with two in serious condition.

Since it was early, the train only carried about 30 passengers, officials said. Only one passenger was sitting in the first car, for business-class, which overturned.

Lodi Prefect Marcello Cardona told ANSA the crash “could have been a carnage” if the train were full.

The remaining train cars remained upright. Rescuers had to help some passengers out of the train.

ITALIAN DRIVER EVADES FLAMING CARS IN BOTCHED HIGHWAY ROBBERY ATTEMPT

"I thought I was dead," a passenger told local daily Liberta, according to the BBC. "I closed my eyes and prayed. The train was going very fast... suddenly, I felt a violent blow. A really loud roar."

Fabiano said work had been done on that stretch of the line during the night. But he said it was unclear if that was a factor in the crash, whose cause was under investigation.

Authorities said it was possible the engine car automatically decoupled from the cars behind it as part of a safety mechanism to prevent the rest of the train from following the engine car in case of derailments.

Rail traffic was diverted to local tracks with delays of about an hour reported as investigators remained at the scene.

CLICK HERE FOR THE FOX NEWS APP

In other recent derailments near Milan, three people were killed and more than 100 injured when a regional train derailed on another line in January 2018.

The Associated Press contributed to this report.