Construction workers are seen next to heavy machinery while working on a new border wall in Santa Teresa, New Mexico, as seen from the Mexican side of the border in San Jeronimo, on the outskirts of Ciudad Juarez, Mexico April 23, 2018.

A U.S. federal judge on Monday rejected a lawsuit by Democrats in the House of Representatives that sought to block President Donald Trump's plan to divert funds to help build a border wall.

District Court Judge Trevor McFadden of the District of Columbia ruled that the House lacked legal standing to sue Trump for using money to build a wall on the U.S.-Mexico border that was appropriated by Congress for other purposes.

"While the Constitution bestows upon Members of the House many powers, it does not grant them standing to hale the Executive Branch into court claiming a dilution of Congress's legislative authority. The Court therefore lacks jurisdiction to hear the House's claims and will deny its motion," McFadden wrote.

House Democrats had argued diverting the funds violated the separation of powers doctrine laid out in the U.S. Constitution.

The Justice Department applauded the ruling.

"The court rightly ruled that the House of Representatives cannot ask the judiciary to take its side in political disputes and cannot use federal courts to accomplish through litigation what it cannot achieve using the tools the Constitution gives to Congress," a department spokesman said in a statement.

A spokesman for House Speaker Nancy Pelosi said Democrats were reviewing the ruling and evaluating whether to appeal.

The ruling is in contrast to a decision on May 24 by U.S. Judge Haywood Gilliam Jr., who issued a preliminary injunction blocking the use of $1 billion in Defense Department funds out of a total of $6.7 billion Trump wants to divert for the border wall.

Gilliam, in Oakland, California, on May 30 rejected the government's efforts to start construction of the wall while it appeals to a higher court.

In February, after a protracted political battle and a government shutdown, Congress approved $1.38 billion for construction of "primary pedestrian fencing" along the border in southeastern Texas, well short of Trump's demands.

To obtain the additional money, Trump declared a national emergency and his administration said it planned to divert $601 million from a Treasury Department forfeiture fund, $2.5 billion earmarked for Department of Defense counternarcotics programs and $3.6 billion from military construction projects.