The Supreme Court sided with the Trump administration on Friday in lifting a freeze backed by a lower court that had halted plans to use $2.5 billion in Pentagon funds for border wall construction.

The decision, which split the bench along ideological lines, allows the administration to move ahead with plans to use military funds to replace existing fencing in California, Arizona and New Mexico.

The conservative justices on the court ruled in favor of the administration. Liberal justices Elena Kagan, Ruth Bader Ginsburg and Sonia Sotomayor dissented. And Justice Stephen Breyer issued a split opinion, agreeing in part with both sides.

The president celebrated the ruling on Twitter: “Wow! Big VICTORY on the Wall. The United States Supreme Court overturns lower court injunction, allows Southern Border Wall to proceed. Big WIN for Border Security and the Rule of Law!”

“We are pleased that the Supreme Court recognized that the lower courts should not have halted construction of walls on the southern border,” Justice Department spokesperson Alexei Woltornist said in a statement. “We will continue to vigorously defend the Administration’s efforts to protect our Nation.”

The American Civil Liberties Union (ACLU), which opposes the funding for the wall, vowed to keep fighting.

“This is not over,” said Dror Ladin, a staff attorney with the ACLU’s National Security Project. “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.”

The ruling means the Trump administration can tap the funds and begin work covered by four contracts it has awarded.

A trial court initially froze the funds in May and an appeals court kept that freeze in place earlier this month. The Trump administration asked the Supreme Court to take up the issue.

Earlier this month, a divided three-judge panel of the 9th U.S. Circuit Court of Appeals in San Francisco agreed with a lower-court ruling that prevented the government from tapping Defense Department counterdrug money to build high-priority sections of the planned wall in the three aforementioned states.

At stake is billions of dollars in funding that would allow Trump to make progress on a major 2016 campaign promise heading into his race for a second term.

Trump declared a national emergency after losing a funding fight with the Democrat-led House that resulted in a 35-day government shutdown. Congress agreed to spend nearly $1.4 billion on barriers in Texas’ Rio Grande Valley, the busiest corridor for illegal crossings, an amount well below the $5.7 billion the president had sought.

Trump grudgingly accepted the money but declared the emergency in order to tap up to $8.1 billion for wall construction. That amount includes $3.6 billion from military construction funds, $2.5 billion from Defense Department counterdrug activities and $600 million from the Treasury Department’s asset forfeiture fund.

Fox News’ Shannon Bream and Bill Mears and The Associated Press contributed to this report.