WASHINGTON—The Supreme Court cleared the way Friday 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 greenlight to begin work on four contracts it has awarded using Defense Department money. Funding for the projects had been frozen by lower courts. The court’s four liberal justices wouldn’t have allowed construction to start.

The justices’ decision to lift the freeze on the money allows 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!”

A trial court initially froze the funds in May and an appeals court 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 on 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 of fencing. One project would replace 46 miles of barrier in New Mexico for $789 million. Another would replace 63 miles 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 waiting on approval from the defense secretary.

The lawsuit at the Supreme Court challenging the use of the Defense Department funds was brought by the American Civil Liberties Union on behalf of the Sierra Club and Southern Border Communities Coalition.