On Friday, the Supreme Court voted 5-4 to permit President Donald Trump to use $2.5 billion in Pentagon funds for construction of his southern border wall.

The Supreme Court said the groups that challenged the Trump administration did not seem to have a legal right to do so.

One of the court’s left-leaning judges, Justice Stephen Breyer, wrote in his dissent that he would have permitted the White House to seek preparatory work instead of construction.

SLIDESHOW: TOP DEMOCRATS RUNNING FOR PRESIDENT IN 2020

The high court’s ruling came on the same day Trump reached a deal with Guatemala meant to reduce the influx of Central American migrants looking for refuge in the United States. Under the pact, migrants would be forced to seek asylum in Guatemala before reaching the U.S.

The case surrounding the border wall involved injunctions that halted the transfer of military funds for the barrier’s construction.

Breyer also reportedly noted in his dissent that the White House could lose access to the funds for the border wall if if failed to finalize contracts by the end of September.

Trump declared a national emergency along the border with Mexico in February. This came after a two-month dispute with Congress — that included a record-breaking partial government shutdown — over funding for the barrier. The president has long railed against what he perceives are large numbers of illegal immigrants bringing drugs and other crime across the southern border.

“The case is not about whether the challenged border barrier construction plan is wise or unwise. It is not about whether the plan is the right or wrong policy response to existing conditions at the southern border of the United States,” Judge Haywood Gilliam Jr. of the U.S. District Court in Oakland, California wrote in his decisions. “Instead, this case presents strict legal questions regarding whether the proposed plan for funding border barrier construction exceeds the executive branch’s lawful authority.”

Two advocacy groups represented by the American Civil Liberties Union — the Southern Border Communities Coalition and the Sierra Club — reportedly filed a lawsuit to halt Trump’s plan to use defense funds for the border wall’s construction in order to curb drug trafficking.