The US Supreme Court on Friday ruled in favour of president Donald Trump, allowing him to proceed with plans to divert billions of dollars in Pentagon funds towards construction of his border wall with Mexico.
"Wow! Big VICTORY on the Wall," Trump tweeted in reaction to the ruling, which boosts his ability to fulfil a major campaign promise to construct the massive barrier. "Big WIN for Border Security and the Rule of Law!"
Trump declared a national emergency earlier this year in a bid to bypass Congress and obtain funding for his signature project, after the standoff led to the longest government shutdown in US history.
But about 20 US states along with rights and environmental groups and border communities are backing lawsuits that claim the emergency declaration violates the constitution.
A federal judge on the Ninth Circuit Court of Appeals had issued a temporary injunction against using Defence Department funds for wall construction.
On Friday, the Supreme Court overturned the lower court decision with a 5-4 ruling, writing that the government had "made a sufficient showing at this stage" that the groups did not have the standing to challenge the allocation of funds, freeing up the money for the president's use while litigation proceeds.
House Speaker Nancy Pelosi and Senate Minority Leader Chuck Schumer, the top congressional Democrats, denounced the ruling.
Pelosi insinuated that the president had exercised executive overreach in bypassing Congress to get the funding, writing on Twitter that "our Founders designed a democracy governed by the people - not a monarchy."
Schumer, meanwhile, called the matter "deeply regrettable" and "nonsensical," adding that it "flies in the face of the will of Congress and the Congress's exclusive power of the purse."
Trump had originally requested $5.7 billion for his border wall, but after a tug-of-war that included a record 35-day federal government shutdown, he reluctantly signed a spending bill that included appropriations of just $1.4 billion for border barriers, and not specifically a wall.
Then, citing an "invasion" of drugs and criminals, he declared a national emergency at the border, allowing him to repurpose billions of dollars in other government funding.
The $2.5 billion in Defence Department funds at play in the Supreme Court ruling were part of that repurposed money.
The American Civil Liberties Union (ACLU) immediately vowed to seek an expedited decision from the Ninth Circuit "to halt the irreversible and imminent damage from Trump's border wall."
"Border communities, the environment, and our Constitution's separation of powers will be permanently harmed should Trump get away with pillaging military funds for a xenophobic border wall Congress denied," said Dror Ladin, attorney with the ACLU's national security project.
Trump made the construction of a wall to stem illegal immigration from Latin America central to his successful 2016 campaign for the presidency.
The number of border-crossers detained by the US Border Patrol surged to a 13-year high of more than 144,000 in May before easing to 104,000 in June -- still up 142 per cent from a year earlier.
The Supreme Court victory was the second piece of good news for Trump, who earlier in the afternoon announced that a "landmark" asylum agreement had been reached with Guatemala, which Trump claimed would classify the Central American nation as a "safe third country," meaning that US-bound migrants who enter the country would be required to seek asylum there instead.
However the US Department of Homeland Security said the term did not appear in the agreed text.