CNN  — 

The Supreme Court on Friday cleared the way for the Trump administration to use $2.5 billion from the Department of Defense to construct parts of a wall along the southwestern border that the government argues is necessary to protect national security.

The decision allows the Defense Department money to be spent now while a court battle plays out over whether the government had the authority to divert funds that were not appropriated for the wall. The Supreme Court voted 5-4, along ideological lines, to allow the funds to be used while the court appeals proceed.

In a brief order, the court said that it was ruling in favor of the Trump administration before the litigation has played out because the government had made a “sufficient showing” that the challengers did not have the legal right to bring the case.

Three members of the liberal wing of the court – Justices Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan – wrote they would have blocked the funds for now. The fourth member, Justice Stephen Breyer, wrote separately to say that he would have allowed the government to use the funds to finalize the terms for contractors but block the funds from being used for the actual construction.

The Supreme Court’s order is a significant win for Trump, who is likely to use the construction of a wall as a major talking point on the campaign trail. The President celebrated the decision in a tweet Friday evening.

“The United States Supreme Court overturns lower court injunction, allows Southern Border Wall to proceed,” the President tweeted. “Big WIN for Border Security and the Rule of Law!”

The decision overrules a lower court decision that had blocked the transfer of funds while appeals played out. A panel of judges from the 9th Circuit Court of Appeals refused to allow the use of the funds earlier in the month, holding that the challengers were likely to prevail in their case because the use of the funds “violates the constitutional requirement that the Executive Branch not spend money absent an appropriation from Congress.”

The order comes after Trump ended a 35-day government shutdown in February when Congress gave him $1.4 billion in wall funding, far less than he had sought. He subsequently declared a national emergency to get money from other government accounts to construct sections of the wall.

The $2.5 billion had been shifted from various programs including personnel and recruiting, Minuteman III and air launch cruise missiles, E-3 aircraft upgrades and the Afghan security forces training fund. The Pentagon said it was able to move that money due to uncovered cost savings as part of a process known as “reprogramming.” The money was moved into a Defense Department counter-drug account that is authorized to spend money on the construction of border barriers.

Many lawmakers slammed the decision to move the money away from those national security priorities, threatening to strip the Pentagon of its ability to move money around, something the Defense Department has acknowledged would be detrimental.

“We are pleased with the Supreme Court’s decision,” Pentagon spokeswoman Cmdr. Rebecca Rebarich told CNN.

Lawyers for the government had asked the Supreme Court to step in on an emergency basis and unblock the use of the funds while legal challenges proceed in the lower courts.

Solicitor General Noel Francisco noted in court papers that the projects needed to start because the funds at issue “will no longer remain available for obligation after the fiscal year ends on September 30, 2019.” He said that the funds are necessary to permit the construction of more than 100 miles of fencing in areas the government has identified as “drug-smuggling corridors” where it has seized “thousands of pounds of heroin, cocaine and methamphetamine” in recent years.

“Respondents’ interests in hiking, birdwatching, and fishing in designated drug-smuggling corridors do not outweigh the harm to the public from halting the government’s efforts to construct barriers to stanch the flow of illegal narcotics across the southern border,” Francisco argued in the papers, regarding the challenge from environmental groups.

Legal expert Joshua Matz said the decision is a major victory for Trump.

“But the Court did not signal that Trump followed the law. Instead, the majority took a narrow view of who, if anybody, is allowed to challenge Trump’s decision in court,” he said.

It is a loss for critics, including the Sierra Club and the Southern Border Communities Coalition that argued the administration had illegally transferred the funds after Congress denied requests for more money to construct the wall. The groups argued the wall – in areas in Arizona, California and New Mexico – would harm the environment.

The American Civil Liberties Union, representing the groups, argued in court papers against a stay of the lower court ruling, fearful of the wall’s impact on border communities.

“Issuance of a stay that would permit Defendants to immediately spend this money is not consistent with Congress’s power over the purse or with the tacit assessment by Congress that the spending would not be in the public interest,”ACLU lawyers told the court.

The ACLU slammed the decision after it was released Friday evening.

“This is not over. We will be asking the federal appeals court to expedite the ongoing appeals proceeding 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, a staff attorney with the ACLU’s National Security Project.

This story has been updated.

CNN’s Ryan Browne contributed to this report.