Congress gave the nation’s railroads three more years, and possibly up to five, to install a mandated safety system that would automatically slow trains running at unsafe speeds, and which safety experts say could have prevented May’s fatal Amtrak derailment in Philadelphia.

Positive train control, which can remoted brake speeding trains, was supposed to be installed on major passenger and freight lines by the end of 2015, but only a few commuter railroads and no freight lines expected to meet the deadline.

Now they will have at least until December, 31, 2918, with the potential for extensions up to the end of 2020.

The new deadline was lobbied for by railroads and opposed by safety advocates. Railroads said the original deadline was unrealistic and they have been slow to comply due to budget shortfalls and technical issues. Freight lines have spent about $6 billion on train control systems, but none will have the system in place by year end. Freight and commuter lines have warned that they might have to cease operations without a compliance extension.

The National Transportation Safety Board has called for installment of positive train control since 1970. The NTSB estimates the system could have prevented 140 accidents that resulted in nearly 300 fatalities since 1970.

Sen. Barbara Boxer (D-CA), who helped set the positive train control deadline seven years ago in 2008, blasted the extension. Supporters of the extension expressed relief that a possible rail shutdown with what they claimed would be devastating economic consequences had been avoided.