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., on Friday immediately halted the administration's efforts to redirect military-designated funds for wall construction. His order applies to two high-priority projects, scheduled to begin as early as Saturday, to replace 51 miles (82 kilometers) of fence in two areas on the Mexican border. 

More Images
FILE - In this March 13, 2018, file photo, President Donald Trump holds a poster with photographs of the U.S. - Mexico border area as he reviews border wall prototypes in San Diego with Rodney Scott, the U.S. Border Patrol's San Diego sector chief. U.S. District Judge Haywood Gilliam Jr. has blocked President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency, Friday, May 24, 2019. (AP PhotoEvan Vucci, File)

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.

FILE - In this Feb. 27, 2019, file photo, a border wall prototype falls during demolition at the border between Tijuana, Mexico, and San Diego. The government is demolishing eight prototypes of Donald Trump's prized border wall that instantly became powerful symbols of his presidency when they were built nine months after he took office. U.S. District Judge Haywood Gilliam Jr. has blocked President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency, Friday, May 24, 2019. (AP PhotoGregory Bull, File)

Gilliam, an appointee of President Barack Obama, said the plaintiffs were likely to succeed on arguments that the president was wrongly ignoring Congress' wishes.

FILE - In this Jan. 3, 2019, file photo, a migrant from Honduras passes a child to her father after he jumped the border wall to get into the U.S. side to San Diego, Calif., from Tijuana, Mexico. A federal judge is expected to decide Friday, May 24 whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoDaniel Ochoa de Olza, File)

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

FILE - In this Nov. 21, 2018, file photo, two Honduran men pose as a photographer, at left, takes their picture after the group climbed the border wall separating Tijuana, Mexico, and San Diego, before climbing back down on the Mexican side, seen from San Diego. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoGregory Bull, File)

The president's adversaries say the emergency declaration was an illegal attempt to ignore Congress, which authorized far less wall spending than Trump wanted.

FILE - In this March 11, 2019, file photo, construction crews replace a section of the primary wall separating San Diego, above right, and Tijuana, Mexico, below left, seen from Tijuana, Mexico. President Donald Trump is reviving his border wall fight, preparing a new budget that will seek $8.6 billion for the U.S-Mexico barrier while imposing steep spending cuts to other domestic programs and setting the stage for another fiscal battle. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoGregory Bull, File)

It wasn't a total defeat for the administration.

FILE - In this Feb. 5, 2019 file photo, Border Patrol agent Vincent Pirro walks towards prototypes for a border wall in San Diego. Customs and Border Protection said Friday, Feb. 22, 2019, President Trump's eight border-wall prototypes will be torn down to make way for a secondary barrier separating California from Mexico. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency (AP PhotoGregory Bull, File)

The courtroom showdowns come amid a flurry of activity to accelerate wall construction.

FILE - In this April 5, 2019 file photo, President Donald Trump participates in a roundtable on immigration and border security at the U.S. Border Patrol Calexico Station in Calexico, Calif. A federal judge is expected to decide Friday, May 24, 2019 whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. California and 19 other states, along with environmentalists, civil liberties groups and communities along the border, are seeking a temporary injunction to halt construction plans.(AP PhotoJacquelyn Martin, File)

The Army Corps of Engineers recently announced several large contacts with Pentagon funding. Last month, SLSCO Ltd. of Galveston, Texas, won a $789 million award to replace 46 miles (74 kilometers) of barrier in New Mexico.

Gilliam issued the ruling after hearing arguments last week in two cases. California and 19 other states brought one lawsuit; the Sierra Club and a coalition of communities along the border brought the other. His ruling was the first of several lawsuits against Trump's controversial decision to bypass the normal appropriations process to pay for his long-sought wall.

FILE - In this March 13, 2018, file photo, President Donald Trump holds a poster with photographs of the U.S. - Mexico border area as he reviews border wall prototypes in San Diego with Rodney Scott, the U.S. Border Patrol's San Diego sector chief. U.S. District Judge Haywood Gilliam Jr. has blocked President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency, Friday, May 24, 2019. (AP PhotoEvan Vucci, File)

FILE - In this March 13, 2018, file photo, President Donald Trump holds a poster with photographs of the U.S. - Mexico border area as he reviews border wall prototypes in San Diego with Rodney Scott, the U.S. Border Patrol's San Diego sector chief. U.S. District Judge Haywood Gilliam Jr. has blocked President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency, Friday, May 24, 2019. (AP PhotoEvan Vucci, File)

Gilliam, an appointee of President Barack Obama, said the plaintiffs were likely to succeed on arguments that the president was wrongly ignoring Congress' wishes.

"Congress's 'absolute' control over federal expenditures_even when that control may frustrate the desires of the Executive Branch regarding initiatives it views as important_is not a bug in our constitutional system. It is a feature of that system, and an essential one," he wrote in his 56-page opinion.

A judge in Washington, D.C., is hearing a similar challenge brought by the U.S. House of Representatives that argued the money shifting violates the constitution. The judge was weighing whether the lawmakers even had the ability to sue the president instead of working through political routes to resolve the bitter dispute.

FILE - In this Feb. 27, 2019, file photo, a border wall prototype falls during demolition at the border between Tijuana, Mexico, and San Diego. The government is demolishing eight prototypes of Donald Trump's prized border wall that instantly became powerful symbols of his presidency when they were built nine months after he took office. U.S. District Judge Haywood Gilliam Jr. has blocked President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency, Friday, May 24, 2019. (AP PhotoGregory Bull, File)

FILE - In this Feb. 27, 2019, file photo, a border wall prototype falls during demolition at the border between Tijuana, Mexico, and San Diego. The government is demolishing eight prototypes of Donald Trump's prized border wall that instantly became powerful symbols of his presidency when they were built nine months after he took office. U.S. District Judge Haywood Gilliam Jr. has blocked President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency, Friday, May 24, 2019. (AP PhotoGregory Bull, File)

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

Trump declared a national emergency in February after losing a fight with the Democratic-led House over fully paying for the wall that led to a 35-day government shutdown. As a compromise on border and immigration enforcement, Congress set aside $1.375 billion to extend or replace existing barriers in Texas' Rio Grande Valley, the busiest corridor for illegal crossings.

Trump grudgingly accepted the money, but then declared the national emergency to siphon money from other government accounts because he wanted to spend $8 billion on wall construction. The funds include $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.

FILE - In this Jan. 3, 2019, file photo, a migrant from Honduras passes a child to her father after he jumped the border wall to get into the U.S. side to San Diego, Calif., from Tijuana, Mexico. A federal judge is expected to decide Friday, May 24 whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoDaniel Ochoa de Olza, File)

FILE - In this Jan. 3, 2019, file photo, a migrant from Honduras passes a child to her father after he jumped the border wall to get into the U.S. side to San Diego, Calif., from Tijuana, Mexico. A federal judge is expected to decide Friday, May 24 whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoDaniel Ochoa de Olza, File)

The president's adversaries say the emergency declaration was an illegal attempt to ignore Congress, which authorized far less wall spending than Trump wanted.

"We welcome the court's decision to block Trump's attempts to sidestep Congress to build deadly walls that would hurt communities living at the border, endanger wildlife, and have damaging impacts on the environment," said Andrea Guerrero, a member of the Southern Border Communities Coalition.

The administration said Trump was protecting national security as unprecedented numbers of Central American asylum-seeking families arrive at the U.S. border.

FILE - In this Nov. 21, 2018, file photo, two Honduran men pose as a photographer, at left, takes their picture after the group climbed the border wall separating Tijuana, Mexico, and San Diego, before climbing back down on the Mexican side, seen from San Diego. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoGregory Bull, File)

FILE - In this Nov. 21, 2018, file photo, two Honduran men pose as a photographer, at left, takes their picture after the group climbed the border wall separating Tijuana, Mexico, and San Diego, before climbing back down on the Mexican side, seen from San Diego. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoGregory Bull, File)

It wasn't a total defeat for the administration.

Gilliam rejected a request by the 20 states to block use of Treasury asset forfeiture funds for border wall construction. The states argued that Trump skirted environmental impact reviews but the judge said they were unlikely to prevail on that point.

The administration has said it plans to use the Treasury money to extend barriers in the Rio Grande Valley.

FILE - In this March 11, 2019, file photo, construction crews replace a section of the primary wall separating San Diego, above right, and Tijuana, Mexico, below left, seen from Tijuana, Mexico. President Donald Trump is reviving his border wall fight, preparing a new budget that will seek $8.6 billion for the U.S-Mexico barrier while imposing steep spending cuts to other domestic programs and setting the stage for another fiscal battle. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoGregory Bull, File)

FILE - In this March 11, 2019, file photo, construction crews replace a section of the primary wall separating San Diego, above right, and Tijuana, Mexico, below left, seen from Tijuana, Mexico. President Donald Trump is reviving his border wall fight, preparing a new budget that will seek $8.6 billion for the U.S-Mexico barrier while imposing steep spending cuts to other domestic programs and setting the stage for another fiscal battle. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. (AP PhotoGregory Bull, File)

The courtroom showdowns come amid a flurry of activity to accelerate wall construction.

Kenneth Rapuano, an assistant secretary of defense, said in a court filing last month that work on the highest-priority, Pentagon-funded projects could begin as soon as Saturday. The Defense Department has transferred $2.5 billion to border wall coffers.

The Defense Department transferred $1 billion to border wall coffers in March and another $1.5 billion earlier this month. Patrick Shanahan, the acting defense secretary, is expected to decide soon whether to transfer an additional $3.6 billion.

FILE - In this Feb. 5, 2019 file photo, Border Patrol agent Vincent Pirro walks towards prototypes for a border wall in San Diego. Customs and Border Protection said Friday, Feb. 22, 2019, President Trump's eight border-wall prototypes will be torn down to make way for a secondary barrier separating California from Mexico. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency (AP PhotoGregory Bull, File)

FILE - In this Feb. 5, 2019 file photo, Border Patrol agent Vincent Pirro walks towards prototypes for a border wall in San Diego. Customs and Border Protection said Friday, Feb. 22, 2019, President Trump's eight border-wall prototypes will be torn down to make way for a secondary barrier separating California from Mexico. A federal judge is expected to decide Friday, May 24, 2019, whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency (AP PhotoGregory Bull, File)

The Army Corps of Engineers recently announced several large contacts with Pentagon funding. Last month, SLSCO Ltd. of Galveston, Texas, won a $789 million award to replace 46 miles (74 kilometers) of barrier in New Mexico.

Last week, Southwest Valley Constructors of Albuquerque, New Mexico, won a $646 million award to replace 63 miles (101 kilometers) in the Border Patrol's Tucson, Arizona, sector. Barnard Construction Co. of Bozeman, Montana, won a $141.8 million contract to replace 5 miles (8 kilometers) in Yuma and 15 miles (24 kilometers) in El Centro, California.

Aside from California, states participating in the legal challenge are Colorado, Connecticut, Delaware, Hawaii, Illinois, Maine, Maryland, Massachusetts, Michigan, Minnesota, Nevada, New Jersey, New Mexico, New York, Oregon, Rhode Island, Vermont, Virginia and Wisconsin.

FILE - In this April 5, 2019 file photo, President Donald Trump participates in a roundtable on immigration and border security at the U.S. Border Patrol Calexico Station in Calexico, Calif. A federal judge is expected to decide Friday, May 24, 2019 whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. California and 19 other states, along with environmentalists, civil liberties groups and communities along the border, are seeking a temporary injunction to halt construction plans.(AP PhotoJacquelyn Martin, File)

FILE - In this April 5, 2019 file photo, President Donald Trump participates in a roundtable on immigration and border security at the U.S. Border Patrol Calexico Station in Calexico, Calif. A federal judge is expected to decide Friday, May 24, 2019 whether to block the White House from spending billions of dollars to build a wall on the Mexican border with money secured under President Donald Trump's declaration of a national emergency. California and 19 other states, along with environmentalists, civil liberties groups and communities along the border, are seeking a temporary injunction to halt construction plans.(AP PhotoJacquelyn Martin, File)