Emergency personnel work at the scene of a deadly train derailment in Philadelphia in May. (Patrick Semansky/AP)

The Senate on Wednesday approved a measure that extends federal transportation funding for three weeks, along with a provision that gives the railroad industry at least three more years to implement life-saving automatic-braking technology.

Bowing to the reality that railroads were far from meeting the year-end deadline for the installation of the brake technology, known as Positive Train Control (PTC), the Senate joined the House in granting the extension. The original deadline, set in 2008, will now be extended to 2018, and, under certain circumstances, to 2020.

The move follows years of halting progress and aggressive lobbying by the railroads, which argued that the multibillion-dollar mandate was too complex and costly to finish on time.

The industry, led by large freight railroads, had presented an economic doomsday scenario if the deadline for implementing the technology was not extended. Sen. John Thune (R-S.D.) said the extension was critical to avoid “devastating” economic consequences.

Sen. Barbara Boxer (D-Calif.) had sought a one-year extension instead. She held up a large photograph of the crumpled wreckage of Amtrak Train 188, which derailed in Philadelphia in May, leaving eight dead in a crash that investigators said would have been prevented if PTC had been in place.

Boxer was sharply critical of the way that the extension came about — as part of the must-pass, stopgap funding bill — and blamed the powerful railroad lobby. “It’s a lobby that covers everybody,” Boxer said of both Republicans and Democrats.

Sen. Kirsten Gillibrand (D-N.Y.) said in a statement that “after so many preventable railway tragedies that have led to the loss of life, it is an insult to the families who have lost loved ones to let the rail lobby slip a multi-year Positive Train Control delay into a three-week extension.”

Gillibrand said the rail industry “has purposely dragged its feet in meeting its safety requirements.”

Sen. Jerry Moran (R-Kan.) disputed that characterization, saying the delay “has nothing to do with a lack of commitment by the railroads. It has to do with the fact we cannot get there in the time we had hoped for originally.”

A spokesman for the Association of American Railroads said that the industry has spent nearly $6 billion on implementing PTC and that much progress is being made.

In a statement, the association said the House and Senate “are to be commended for taking the responsible action to extend the PTC deadline. This provides the certainty American industries and businesses need to serve the millions of Americans who rely on rail every day.”

In addition to approving the spending bill, the Senate approved the nomination of Sarah Feinberg as head of the Federal Railroad Administration.

Feinberg, a former chief of staff to Transportation Secretary Anthony Foxx, had been acting administrator since January.

In a statement, Feinberg said that PTC “will prevent accidents and save lives” and “should be implemented as soon as possible. The additional tools that Congress has given the FRA will allow us to hold railroads accountable so that they meet critical milestones on the path to full implementation.”

The transportation funding extension until Nov. 20 will keep highway and transit funding that state and local projects rely on at current levels. It was the third extension this year, and the 14th in recent years.

Unlike earlier extensions this year and last, it will not require finding additional funding that critics have called gimmicks. The gas-tax-funded Highway Trust Fund has received a slight boost in recent months and is not expected to run low on cash as rapidly as once anticipated.

The temporary funding measure was passed with the hope that House and Senate conferees can reach agreement by next month on long-term bills passed by both bodies.