WASHINGTON — The Supreme Court cleared the way for the Trump administration to tap billions of dollars in Pentagon funds to build sections of a border wall with Mexico.

The court’s five conservative justices gave the administration the green light on Friday to begin work on four contracts it has awarded using Defense Department money. Funding for the projects had been frozen by lower courts while a lawsuit over the money proceeded. The court’s four liberal justices wouldn’t have allowed construction to start.

The justices’ decision to lift the freeze on the money allows President Donald Trump to make progress on a major 2016 campaign promise heading into his race for a second term. Trump tweeted after the announcement: “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!”

The Supreme Court’s action reverses the decision of a trial court, which initially froze the funds in May, and an appeals court, which kept that freeze in place earlier this month. The freeze had prevented the government from tapping approximately $2.5 billion in Defense Department money to replace existing sections of barrier in Arizona, California and New Mexico with more robust fencing.

The case the Supreme Court ruled in began after the 35-day partial government shutdown that started in December of last year. Trump ended the shutdown in February after Congress gave him approximately $1.4 billion in border wall funding. But the amount was far less than the $5.7 billion he was seeking, and Trump then declared a national emergency to take cash from other government accounts to use to construct sections of wall.

The money Trump identified includes $3.6 billion from military construction funds, $2.5 billion in Defense Department money and $600 million from the Treasury Department’s asset forfeiture fund.

The case before the Supreme Court involved just the $2.5 billion in Defense Department funds, which the administration says will be used to construct more than 100 miles (160 kilometers) of fencing. One project would replace 46 miles (74 kilometers) of barrier in New Mexico for $789 million. Another would replace 63 miles (101 kilometers) in Arizona for $646 million. The other two projects in California and Arizona are smaller.

The other funds were not at issue in the case. The Treasury Department funds have so far survived legal challenges, and Customs and Border Protection has earmarked the money for work in Texas’ Rio Grande Valley but has not yet awarded contracts. Transfer of the $3.6 billion in military construction funds is awaiting approval from the defense secretary.

The lawsuit at the Supreme Court was brought by the American Civil Liberties Union on behalf of the Sierra Club and Southern Border Communities Coalition. The justices who lifted the freeze on the money did not give a lengthy explanation for their decision. But they said among the reasons they were doing so was that the government had made a “sufficient showing at this stage” that those bringing the lawsuit don’t have a right to challenge the decision to use the money.

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

ACLU lawyer Dror Ladin said after the court’s announcement that the fight “is not over.” The case will continue, but the Supreme Court’s decision suggests an ultimate victory for the ACLU is unlikely. Even if the ACLU were to win, fencing will have already been built.

House Speaker Nancy Pelosi, D-Calif., issued a statement accusing Trump of trying to “undermine our military readiness and steal from our men and women in uniform to waste billions on a wasteful, ineffective wall that Congress on a bipartisan basis has repeatedly refused to fund.” She said the Supreme Court’s decision “undermines the Constitution and the law.”

Senate Democratic Leader Chuck Schumer of New York called the decision “deeply regrettable and nonsensical.”

Justices Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan would not have allowed construction to begin. Justice Stephen Breyer said he would have allowed the government to finalize the contracts for the segments but not begin construction while the lawsuit proceeded. The administration had argued that if it wasn’t able to finalize the contracts by Sept. 30, then it would lose the ability to use the funds. The administration had asked for a decision quickly.

The Supreme Court is on break for the summer but does act on certain pressing items.