A billion dollars earmarked for Donald Trump’s long-promised wall on the US border with Mexico must not be spent on the project, a federal judge has ruled.

The order blocked the Department of Defence funds being spent on the barrier because it had not been specifically authorised by congress.

It followed a legal challenge to the outlay by California and 19 other states.

But the ruling did not cover another $5.1bn which is still free to be used by Mr Trump after he declared drugs and crimes entering the US via the Mexican border a national emergency.

In his ruling halting the $1bn, US district judge Haywood Gilliam Jr wrote: “The position that when congress declines the executive's request to appropriate funds, the executive nonetheless may simply find a way to spend those funds without congress does not square with the fundamental separation of powers principles dating back to the earliest days of our republic."

Trump prototypes for Mexico border wall demolished in California Show all 20 1 /20 Trump prototypes for Mexico border wall demolished in California Trump prototypes for Mexico border wall demolished in California The prototypes for President Trump’s border wall are being demolished. AP Trump prototypes for Mexico border wall demolished in California The US Customs and Border protection had built the eight 30-foot tall steel and concrete models near San Diego on the US-Mexico border. Reuters Trump prototypes for Mexico border wall demolished in California A 2018 report from the Government Accountability Office found that the construction challenges presented by the four concrete models would be “extensive” and those presented by two of the other models would be “substantial”. Reuters Trump prototypes for Mexico border wall demolished in California It was intended that Mr Trump would choose his favourite of the designs after testing had been completed. AFP/Getty Trump prototypes for Mexico border wall demolished in California The President is yet to comment. AFP/Getty Trump prototypes for Mexico border wall demolished in California Each prototype cost $300,000 to $500,000 to build and they are being knocked down in order to make way for the San Diego Secondary Wall project which will see up to 14 miles of barrier being built to support the existing steel border fence. AP Trump prototypes for Mexico border wall demolished in California The new barrier will not employ the design of any of the prototypes, instead being built of the favoured steel bollards which make up the current section of the wall at San Diego. Reuters Trump prototypes for Mexico border wall demolished in California The new secondary barrier being built near San Diego. Reuters Trump prototypes for Mexico border wall demolished in California The rubble of one of the demolished prototypes. Reuters Trump prototypes for Mexico border wall demolished in California A steel wall prototype AFP/Getty Trump prototypes for Mexico border wall demolished in California A wall prototype made from a mix of steel and concrete AFP/Getty Trump prototypes for Mexico border wall demolished in California A wall prototype made from a mix of steel and concrete AFP/Getty Trump prototypes for Mexico border wall demolished in California A concrete wall prototype AFP/Getty Trump prototypes for Mexico border wall demolished in California A steel wall prototype AFP/Getty Trump prototypes for Mexico border wall demolished in California A concrete wall prototype AFP/Getty Trump prototypes for Mexico border wall demolished in California A concrete wall prototype AFP/Getty Trump prototypes for Mexico border wall demolished in California A concrete wall prototype AFP/Getty Trump prototypes for Mexico border wall demolished in California A digger approaches the prototype wall AFP/Getty Trump prototypes for Mexico border wall demolished in California Aerial view of the wall prototypes at the US-Mexico border after they were torn down AFP/Getty Trump prototypes for Mexico border wall demolished in California An aerial view showing Tijuana, Mexico on the left and the demolished wall prototypes on the right AFP/Getty

Separately, Judge Gilliam denied a preliminary injunction against the border wall sought by a coalition of 16 states – but did say they could move forward with their case.

Mr Trump has said the wall is needed to address a crisis of on the border, and promised to stem illegal immigration arriving in the country there.

But the new ruling is just the latest in a series of frustrations as he attempts to have his election promise of the barrier turned into reality.

In February, after a protracted political battle and a long government shutdown, congress approved just $1.38bn for construction of "primary pedestrian fencing" along the border in south east Texas – well short of the demanded 2,000 mile wall.

To obtain the additional money, Mr Trump declared a national emergency and his administration said it planned to divert $601m from a Treasury Department forfeiture fund, $2.5bn earmarked for Department of Defence counter-narcotics programmes and $3.6bn from military construction projects.

The House of Representatives, more than a dozen states and two advocacy groups asked Judge Gilliam in California to block the transfer of funds to prevent the wall construction.

Support free-thinking journalism and attend Independent events

They argued the administration should not use funds congress has specifically denied or construct a barrier that was not authorised, nor could the administration work outside the geographic area identified by congress.