Caltrain moved to keep its plan to electrify the Peninsula rail service alive Monday by extending the contracts of the contractors who would do the work for four months.

The contractors were set to start work Wednesday on the electrification of the system, but the Trump administration temporarily pulled the plug on the project by delaying $647 million in federal funds.

The new agreements, hurriedly reached after the administration’s decision, extends the contractors’ ties to the project to June 30 but could cost Caltrain up to $20 million that it hadn’t anticipated spending.

The federal Department of Transportation decided Feb. 17 to delay the award of funding toward the $1.9 billion project until it could be considered as part of the new administration’s budget plan. The withholding of the funds threatened to kill the effort to convert the 153-year-old system from diesel-fueled trains to speedier modern ones powered by electricity.

“If we hadn’t negotiated these extensions, the contracts would have been effectively terminated,” said Caltrans spokesman Seamus Murphy.

The extensions will provide enough time, Murphy said, to allow federal transportation officials to develop their budget. That typically happens in April or May, he said, “but we didn’t want to take anything for granted, so we pushed the deadline back as far as we could.”

The extensions also give Bay Area transportation officials more time to sell the administration on the project. In addition to speeding up service, electrifying the line would allow Caltrain to increase capacity, proponents say. The project would also create jobs not just in the Bay Area but also across the country where railcars are assembled, equipment is built and engineering and planning work is done.

The project’s critics, which include Republican members of Congress from the Central Valley, have urged its defeat, labeling it a vital part of the state’s high-speed rail system, which they consider a waste of money.

Caltrain officials say electrification is needed whether or not high-speed rail becomes part of its system, and they’re trying to spread that message in Washington.

Michael Cabanatuan is a San Francisco Chronicle staff writer. Email: mcabanatuan@sfchronicle.com Twitter: @ctuan