Donald Trump violated US law when he declared a national emergency over the country’s southern border and funnelled taxpayer money towards his campaign promise of building a sprawling wall throughout the region, a federal judge has ruled.

Federal district court judge David Briones described the president’s proclamation as “unlawful” in his ruling, saying the move violated a budget law approved by Congress.

The budget law specifically states “none of the funds made available in this or any other appropriation may be used to increase” federal funding to support Mr Trump’s campaign vow.

Mr Trump declared a national emergency over the US-Mexico border in February, prompting swift backlash from local politicians and Democrats on Capitol Hill.

El Paso County, Texas and the Border Network for Human Rights filed the lawsuit in the US district court for the western district of Texas, demanding a judge block the president from using military construction funds to build his wall.

'Dangerous' overcrowding of migrants in US border facilities Show all 6 1 /6 'Dangerous' overcrowding of migrants in US border facilities 'Dangerous' overcrowding of migrants in US border facilities Photos of detained migrants crowded into cells at the US border - with one holding up a sign reading simply "help" - have been released as part of a new report warning of "dangerous" overcrowding. The memo was sent to the Department of Homeland Security by its Inspector General, containing photos taken at border facilities in the Rio Grande Valley over a week in June DHS/OIG 'Dangerous' overcrowding of migrants in US border facilities Eighty-eight adult males held in a cell with a maximum capacity of 41, some signalling prolonged detention to OIG Staff on June 12 DHS/OIG 'Dangerous' overcrowding of migrants in US border facilities Overcrowding of families observed by OIG on June 11, at a border patrol facility in Weslaco, Texas DHS/OIG 'Dangerous' overcrowding of migrants in US border facilities Migrant families overcrowding a border patrol facility on June 11 in McAllen, Texas DHS/OIG 'Dangerous' overcrowding of migrants in US border facilities Fifty-one adult females held in a cell designated for male juveniles with a capacity for 40 at Border Patrol’s Fort Brown Station DHS/OIG 'Dangerous' overcrowding of migrants in US border facilities Migrant families overcrowding a border patrol facility on June 11 in McAllen, Texas DHS/OIG

The judge provided 10 days for local officials to propose an injunction that would block those military funds from going towards the project in his ruling last Friday.

He said El Paso County “has shown an injury to its reputation and has had to take affirmative steps to avoid harm”.

While the Democrat-led Congress had already approved $1.375bn (£1.09bn) to go towards building the wall, the president imposed a national emergency to effectively pull money from military construction projects and other initiatives, including counter drug and Treasury Foreiture Funds, CNN reported.

The latest ruling applied specifically to a reported $20m (£15.9m) in military construction funds and not the counter drug and treasury forfeiture funds, as Judge Briones wrote.

Kristy Parker, an attorney representing the challengers in the lawsuit, hailed the ruling and told NBC News it “confirms that the president is not a king, and that he cannot override Congress’s power to decide how to appropriate funds”.

Mr Trump’s administration was expected to appeal the decision.

Support free-thinking journalism and attend Independent events

The US Supreme Court has already stayed a previous ruling that blocked federal funding towards expanding the president’s wall construction in Arizona and California.