A federal judge has temporarily blocked part of President Trump’s plan to build a wall along the southern border with money Congress never appropriated for that purpose.

U.S. District Judge Haywood Gilliam Jr., of the Northern District of California, said those challenging Trump’s actions had a good chance of prevailing on their claims that the administration is acting illegally in shifting money from other programs to pay for the wall.

With some contracts already awarded for construction, Gilliam said that allowing work to go forward before the legal issues have been fully resolved could cause irreparable harm.

Gilliam ruled in response to lawsuits brought by the Sierra Club and the Southern Border Communities Coalition.

The plaintiffs sought preliminary injunctions against the administration’s diversion of billions of dollars meant for other purposes. The plaintiffs alleged that Trump’s actions violate the constitutional requirement that no money may be spent without an appropriation from Congress as well as legal restrictions on the purposes for which funds can be reallocated.

The motions asked Gilliam to block any wall-related activity paid for by those funds while he fully considers the merits of the suits.

Though money has been moved from some accounts, transfers that Gilliam ruled against Friday, no money has been transferred from the emergency military construction fund for which the president declared a state of emergency in February. Gilliam said he would rule on that issue separately when the administration actually shifts money.

According to an administration submission to the court, six contracts have been awarded for construction using the money at issue, with additional contracts on the way.

A lawyer for the House of Representatives participated in the hearing as an amicus.

The ruling is the latest chapter in Trump’s quest for a “big, beautiful wall” on the southern border to keep out illegal migrants. Construction of the wall at Mexico’s expense was a central promise of Trump’s presidential campaign. Mexico refused, and the president was rebuffed by the Democratic-controlled House, which after a 35-day partial shutdown of the government, appropriated only $1.375 billion, for non-wall border security, of the more than $4 billion the president had requested for wall construction.

Trump promised that if he did not “get a fair deal” from Congress, he would shift money from other government accounts to close the gap. He declared a state of emergency on the southern border on Feb. 15 to tap into one Pentagon fund meant for emergency military construction. So far, the government says that fund has not been touched, allowing the government to argue that it should not be an issue in the cases.

He authorized additional diversions from the Defense and Treasury departments of funds never intended for wall-building.