In his first State of the State address, Gov. Gavin Newsom shocked observers when he said “there simply isn’t a path” for a long-planned bullet train that would travel all the way from San Francisco to Los Angeles.

No one greeted Newsom’s statement with more glee than President Trump, who promptly demanded that California return the federal government’s investment in the project.

On Thursday, Trump made good on his demand.

The Federal Railroad Administration terminated its agreement with the California High-Speed Rail Authority. It said it would cancel nearly $1 billion in funding it’s already promised for the project.

In a statement, the railroad agency said it had found California’s rail agency “has repeatedly failed to comply with the terms of the (fiscal year 2010) agreement and has failed to make reasonable progress on the project. Additionally, California has abandoned its original vision of a high-speed passenger rail service connecting San Francisco and Los Angeles, which was essential to its applications.”

It also said it was still considering options to claw back the $2.5 billion in federal funding it’s already spent for the much-beleaguered rail project.

Newsom was rightfully furious in response. “The Trump administration’s action is illegal and a direct assault on California, our green infrastructure, and the thousands of Central Valley workers who are building this project,” he said in his statement.

The courts will make the ultimate decision as to the legality of the administration’s action. (Newsom has promised to sue, and we urge him to do so.)

But there’s no doubt that the administration’s decision is petty, mean-spirited and wrong.

The high-speed rail project was facing major obstacles before the Trump administration even began its threats. The project has blown through its budget projections. There have been lawsuits, geological obstacles, engineering problems and bureaucratic delays.

But these problems are par for the course when it comes to ambitious transportation projects.

Construction workers have already broken ground on the rail line. Even the eventual completion of the 119-mile Central Valley section will give the state a necessary window to see whether a complete project will provide the economic, social and environmental benefits its backers believe it will.

More importantly, the federal government promised California this money years ago, and California is following through on its promise to build it.

Newsom did the state no favors when he publicly mused about pulling the plug on high-speed rail.

But a responsible administration would use the governor’s misspoken words as an opportunity to extend assistance and guidance, not the chance to play a childish game of takebacks. This course of action would save both California and the federal government time and money.

Instead, the Trump administration is wasting federal taxpayer dollars by incurring an unnecessary legal fight. Talk about a ride to nowhere.

This commentary is from The Chronicle’s editorial board. We invite you to express your views in a letter to the editor. Please submit your letter via our online form: SFChronicle.com/letters.