A federal judge has ruled against House Democrats seeking to temporarily block the Trump administration from using military funds for a wall on the southern border between the U.S. and Mexico.

The Trump-appointed judge, Trevor McFadden, handed the White House a much-needed victory in the fight against illegal immigration after the Trump administration had suffered several consecutive losses in recent weeks on a number of fronts.

McFadden’s ruling states that House Democrats can’t go to court to block President Donald Trump from using military funds to build the border wall “because the Constitution grants the House no standing to litigate these claims.”

“To be clear, the Court does not imply that Congress may never sue the Executive to protect its powers,” McFadden wrote.

However, McFadden ruled against the House because it failed to show it has standing in court and there is lack of a binding precedent, so “the Court cannot assume jurisdiction to proceed to the merits.”

Trump celebrated via tweet Tuesday from overseas in the U.K.

Trump issued a national emergency declaration this year to move Pentagon funding to the border wall project after a record-long government shutdown ended in a stalemate.

A California judge ruled last week to block the White House from using military funds under the national emergency declaration, and House Democrats argued they could sue the president because it was the only option they had. They claimed Trump’s attempt to divert funds appropriated for the military was unconstitutional because only Congress has the power to appropriate funding.

The administration in turn argued that there is no circumstance where the House or the Senate can sue the executive branch.

McFadden didn’t touch on the merits of the emergency declaration because he had already decided the House could not sue in this instance, and should pursue other alternatives.

“Congress has several political arrows in its quiver to counter perceived threats to its sphere of power,” he wrote. “These tools show that this lawsuit is not a last resort for the House.”

“The Court declines to take sides in this fight between the House and the President,” McFadden added.