WASHINGTON — The nation’s top railroad regulator said Wednesday she will enforce a Dec. 31 deadline for commuter and freight railroads to install safety technology that experts say could have prevented a deadly Amtrak derailment last month.

Sarah Feinberg, acting chief of the Federal Railroad Administration, told a House subcommittee that she sympathizes with railroad officials who have said they are unlikely to meet the congressionally mandated deadline.

But Feinberg said that unless Congress acts to extend the deadline, she has no choice but to require railroads to install a technology known as positive train control by the end of the year. Railroads that fail to meet the deadline could face fines of up to $25,000 per day.

“We really do run into a problem on Jan. 1 where the law is the law,” Feinberg told a House Transportation subcommittee. “I can’t extend the deadline, and I won’t extend the deadline.”

Congress mandated in 2008 that Amtrak, commuter railroads and freight railroads install positive train control by the end of this year. The technology can prevent trains from derailing because of excessive speed, as well as collisions between trains. The National Transportation Safety Board first recommended that trains use the technology in 1970. The agency has since investigated at least 140 accidents that positive train control could have prevented, including a May 12 derailment in Philadelphia that killed eight people and injured about 200.

Amtrak still has to do extensive testing of the system but has said it will meet the deadline in the busy Northeast Corridor between Boston and Washington.

Most railroads, however, will not make the deadline. The nation’s largest freight railroads don’t expect to be ready until 2020.

Frank Lonegro, vice president for service design of CSX Transportation, one of the largest freight railroads, said potential fines will not make installation of positive train control occur any faster.

“If doesn’t matter how big the bear is running after you. We can’t run any faster,” Lonegro said.

CSX has spent more than $1.2 billion on positive train control, including $300 million this year, Lonegro said, calling it “an unprecedented technological challenge” for the industry. The company expects to instill needed hardware for positive train control by the end of 2018, with full deployment of the technology by the end of 2020, he said.

Obama administration officials have repeatedly asked Congress to give them power to extend the deadline on a case-by-case basis for railroads that demonstrate a sincere effort to install the technology. However, legislation introduced by Senate Commerce, Science and Transportation Committee Chairman John Thune, R-S.D., and other members of the committee would grant railroads a blanket extension for five to seven years.

Rep. Peter DeFazio, D-Ore., asked Feinberg what would happen if Congress offered railroads flexibility to install the technology as soon as it is practical to do so, both technologically and financially.

“I take my cues from the Congress, and I enforce what the Congress mandates,” she said.

Unless Congress acts, the FRA plans to go ahead with fines and penalties laid out under the law “and be transparent about our approach,” Feinberg said.