Police and investigators cover the body of one of the two men killed in an Amtrak train crash in Chester, Pa., April 3, 2016. The Amtrak train struck a backhoe just south of Philadelphia, causing a derailment. (Michael Bryant/Philadelphia Inquirer via AP)

The Amtrak engineer in a crash that killed two workers doing maintenance on a rail bed south of Philadelphia last year tested positive for marijuana, the National Transportation Safety Board said in a report issued Thursday.

Alexander Hunter, an engineer with New Jersey Transit and Amtrak for 17 years, survived the crash with minor injuries. But two men working on the railway — Joseph Carter Jr., 61, and Peter John Adamovich, 59 — were killed.

The workers were killed April 3 in Chester, Pa., when a southbound passenger train traveling 106 mph struck a backhoe Carter was operating under the supervision of Adamovich.

The crash of Amtrak’s Palmetto train, which was carrying 330 passengers and seven crew members, took place early on a Sunday morning. The southbound train left Philadelphia’s 30th Street Station at 7:32 a.m. and was gathering speed about 18 minutes later as it began to pass through Chester, according to the NTSB.

A massive cleaning machine had been sitting all weekend on track No. 2, one of four tracks that pass through the area. That track had been shut down for the maintenance work. Carter and Adamovich had positioned their backhoe on track No. 3, the one along which Hunter’s train was traveling, according to the NTSB.

Hunter, who was 47 at the time, told investigators he sounded the horn and pulled the train’s emergency brake after “seeing something” on track No. 3, but it was too late to avoid the crash.

“Then, you know, once I realized like — I knew — like, I could see, like when I got closer, that [the backhoe] was pretty well onto my track and I — you know, I knew I was going to hit him,” Hunter told the NTSB investigators two days after the accident. “I could feel the train lift up, and . . . I just kind of curled up in a ball in the deck of the locomotive and waited for it to stop.”

The engine derailed but remained upright. Hunter and 40 people on board were taken to hospitals with minor injuries.

The positive drug test seems to reflect an alarming increase in drug use by railroad workers that was documented last year by the Federal Railroad Administration. Nearly 5 percent of workers involved in accidents in 2016 were found to have used illegal drugs.

The FRA reacted to the Chester crash by requiring that track-bed maintenance workers be included in the extensive drug testing program that has been in place for train crews for more than 30 years.

In 2014, no one tested positive for drug use after a rail accident. In 2015, there were two post-accident drug positives.

Railroad workers are among the most heavily drug-tested employees in the country, faced with drug screening before they are hired, random on-the-job testing and another round of testing every time they make a significant mistake.

After several years in which heroin and illegal opioid use had increased in the general population, it was evident that use of those and other drugs was on the rise in the railroad industry.

In approximately 50,000 random tests each year, there had been no appreciable increase since 2009. But that changed abruptly in 2015: Random tests of railway workers — including engineers, train crew and dispatchers — found drug use had soared by 43 percent.