ROME — A high-speed train derailed before dawn on Thursday in northern Italy, killing two railroad employees, injuring at least 31 other people and prompting renewed concerns about the country’s transportation infrastructure.

The passenger train was traveling near its top speed of more than 180 miles per hour when the engine became detached and the second car went off the tracks at about 5:30 a.m. near the town of Lodi, 19 miles south of Milan, Angelo Borrelli, chief of the Civil Protection, Italy’s emergency services agency, told local radio stations.

Local news reports and the authorities said the engine slammed into a railroad building, killing two drivers who were at the front of the train. Another employee, a cleaner, suffered several arm fractures and 27 passengers suffered nonlife-threatening injuries.

The train derailed “by a railroad switch that should have been placed in a certain position but wasn’t,” said Domenico Chiaro, Lodi’s prosecutor, during a news conference later Thursday afternoon.