SACRAMENTO, Calif. — The Trump administration canceled nearly $1 billion Thursday in federal money for California's high-speed rail project, further throwing into question the future of the ambitious plan to connect Los Angeles and San Francisco.

California Gov. Gavin Newsom immediately pledged to take the administration to court, though the state has not yet filed a lawsuit.

The "action is illegal and a direct assault on California," Newsom said in an emailed statement. "This is California's money, appropriated by Congress, and we will vigorously defend it in court."

The official word of the funding cancellation by the Federal Railroad Administration came several months after President Donald Trump first threatened to withdraw it.

His comments came in response to Newsom shifting the project's immediate focus to a 171-mile stretch of track in the Central Valley, saying there currently wasn't a path for the full line.

Newsom later said he was still committed to building the entire line but wanted to take a "building blocks" approach that first created a working line in the Central Valley.

The state has only about $20 billion available for the project at this time, far short of the estimated $77 billion it would take to complete it.

Newsom has characterized Trump's threats to the project as retribution against California for resisting various Trump administration policies.

While the $929 million is a critical piece of the funding plan, the state did not plan to spend it until 2021. If a court battle over the money drags on, that could put the state in a position to win back the money or get more from the federal government if Democrats win the White House and control of Congress in 2020.

Still, rail officials expressed concern about losing the money.

"Losing a billion is, I would say, devastating to the overall project," said Russ Fong, the project's outgoing chief financial officer. "We have time to hopefully come to some type of resolution before those dollars are actually needed."

Republican Assemblyman Jim Patterson, who represents Fresno and is one of the project's harshest critics, said the state is witnessing "the beginning of the end" for high-speed rail.

The Trump administration has also threatened to make California return $2.5 billion that has already been spent on the project.

California was awarded a total of $3.5 billion from the federal government nearly a decade ago. Keeping the money is contingent on the state completing a 119-mile segment of track in the Central Valley by 2022, as well as environmental reviews on the entire 520-mile line.

Rail officials have said they were poised to make that deadline and that revoking the funds was premature.

Federal officials said California has repeatedly failed to make "reasonable progress" and had abandoned the original vision for the rail line.

The state "has not demonstrated the ability to complete the project, let alone deliver it by the end of 2022," Ronald Batory, administrator of the railroad administration, wrote in a letter to rail officials.

The $1 billion represents about one-twelfth of the money the state was counting on to pay for the initial 119-mile stretch of tracks.

California voters first approved nearly $10 billion in bonds for the high-speed rail project in 2008, and it's been plagued by cost overruns and delays since. It's been paid for with federal money, bond dollars and revenue from the state's cap-and-trade program that requires polluters to pay to emit greenhouse gases.

On the low end of cap-and-trade projections, the state would bring in just enough money to complete the segment of track Newsom is promoting in the Central Valley. In that scenario, losing the $1 billion in federal money would leave the state short of funds.

If cap-and-trade revenues come in on the high end, the project should be fine, Fong said.