U.S. President Donald Trump on Saturday appealed a U.S. judge's ruling that blocked his administration from using $2.5 billion in funds intended for anti-drug activities to construct a wall along the southern border with Mexico.

U.S. Department of Justice lawyers said in a court filing that they were formally appealing Friday's ruling to the 9th U.S. Circuit Court of Appeals.

"We're immediately appealing it, and we think we'll win the appeal," Trump said during a press conference Saturday at a summit of leaders of the Group of 20 major economies in Japan.

"There was no reason that that should’ve happened," Trump said.

Trump says construction of a wall along the U.S.-Mexico border is needed to keep out illegal immigrants and drugs, but he has so far been unable to get congressional approval for such a project.

Judge Blocks Plans to Build Part of Southern Border Wall A federal judge blocked on Friday President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency.U.S. District Judge Haywood Gilliam, Jr., immediately halted the administration’s efforts to redirect military-designated funds for wall construction. His order applies to two high-priority projects to replace 51 miles (82 kilometers) of fence in two areas on the Mexican border.Gilliam issued the ruling after hearing arguments… A federal judge blocked on Friday President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency.U.S. District Judge Haywood Gilliam, Jr., immediately halted the administration’s efforts to redirect military-designated funds for wall construction. His order applies to two high-priority projects to replace 51 miles (82 kilometers) of fence in two areas on the Mexican border.Gilliam issued the ruling after hearing arguments…

In February, the Trump administration declared a national emergency to reprogram $6.7 billion in funds that Congress had allocated for other purposes to build the wall, which groups and states including California had challenged.

On Friday, U.S. District Judge Haywood Gilliam in Oakland, Calif., said in a pair of court decisions that the Trump administration's proposal to transfer Defense Department funds intended for anti-drug activities was unlawful.

One of Gilliam's rulings was in a lawsuit filed by California on behalf of 20 states, while the other was in a case brought by the American Civil Liberties Union in coordination with the Sierra Club and the Southern Border Communities Coalition.

"These rulings critically stop President Trump’s illegal money grab to divert $2.5 billion of unauthorized funding for his pet project," California Attorney General Xavier Becerra said in a statement late Friday. "All President Trump has succeeded in building is a constitutional crisis, threatening immediate harm to our state."