Associated Press

OAKLAND, Calif. — A federal judge on Friday prohibited President Donald Trump from tapping $2.5 billion in military funding to build high-priority segments of his prized border wall in California, Arizona and New Mexico.

Judge Haywood S. Gilliam, Jr. in Oakland acted in two lawsuits filed by California and by activists who contended that the money transfer was unlawful and that building the wall would pose environmental threats.

“All President Trump has succeeded in building is a constitutional crisis, threatening immediate harm to our state,” said California Attorney General Xavier Becerra, who led a 20-state coalition of attorneys general in one lawsuit.

The decisions are in line with Gilliam’s ruling last month that blocked work from beginning on two of the highest-priority projects – one spanning 46 miles (74 kilometers) in New Mexico and another covering 5 miles (8 kilometers) in Yuma, Arizona.

But the fight is far from over. The U.S. 9th Circuit Court of Appeals is expected to take up the same issue of using military money next week.

Related:'There was and is no national emergency': ACLU sues Trump over order for border wall

Is Trump's border wall being built?:Here are the facts

At issue is Trump’s February declaration of a national emergency so that he could divert $6.7 billion from military and other sources to begin construction of the wall, which could have begun as early as Monday.

Trump declared the emergency after losing a fight with the Democratic-led House that led to a 35-day government shutdown.

The president identified $3.6 billion from military construction funds, $2.5 billion from Defense Department counterdrug activities and $600 million from the Treasury Department’s asset forfeiture fund.

The judge Friday didn’t rule on funding from the military construction and Treasury budgets.

In the second suit, brought by the American Civil Liberties Union on behalf of Sierra Club and the Southern Border Communities Coalition, the judge determined that the use of the $2.5 billion for two sectors of the wall was unlawful, although he rejected environmental arguments that wall construction would threaten species such as bighorn sheep.