US District Judge Haywood Gilliam Jr (pictured) halted the administration's efforts to redirect military-designated funds to build sections of wall on the border on Friday

A federal judge in California has blocked President Donald Trump from building sections of his long-sought border wall with money secured under his declaration of a national emergency.

US District Judge Haywood Gilliam Jr immediately halted the administration's efforts to redirect military-designated funds to build sections of wall on the Mexican border on Friday.

His order applies to two planned projects to add 51 miles of fence in two areas.

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.

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

He declared the emergency in February after losing a fight over fully paying for the wall.

That led to a 35-day government shutdown.

On Wednesday, the US Customs and Border Protect agency updated its accounting of progress on Trump's border wall project, concluding that 42 miles of border barriers have been completed since he took office.

That's more than double the 20 miles of finished walls that the agency reported in an internal document DailyMail.com obtained Monday.

Trump declared the emergency in February after losing a fight over fully paying for the wall. That led to a 35-day government shutdown

The judge's order applies to two planned projects to add 51 miles of fence in two areas (file image)

But that 'Border Wall Status' summary contradicted itself in two places, raising questions that CBP corrected three days later.

The totals in the new report dated Thursday still fall short of what the president pledged hours later, on a day when he agreed to omit new wall funding from a $19.1 billion disaster aid bill in order to get it to his desk.

'We will soon have hundreds of miles under construction,' he told reporters at the White House, 'and we'll have way over 400 miles completed by the end of next year'.

That self-imposed deadline is supposed to arrive in time to help with his re-election effort.

White House Press Secretary Sarah Sanders said Wednesday that between 100 and 115 miles of the president's long-promised wall are finished.

On Monday Trump said the end of 2020 would see 500 miles brought to completion.

The new CBP report also downgrades from 255 to 205 the number of miles for which the administration has secured funding outside a Pentagon financing channel that Trump activated when he declared a national emergency in February.

Both versions suggest 336 miles are funded overall, including the Defense Department's role during Trump's presidency.

Thursday's report concludes that 12.5 per cent of it is done so far.

'Since January 2017, approximately 205 miles of new and replacement border barriers have been funded through the traditional appropriations process and via Treasury Forfeiture Funding, of which approximately 42 miles have been completed to date,' Thursday's report reads.

Throughout, CBP changed how it refers to sections of wall erected along sections of the US-Mexico border where weaker barriers existed before Trump's inauguration.

Where Monday's report referred to 'updated' walls, Thursday's describes 'replacements'.

On Wednesday, the US Customs and Border Protect agency updated its accounting of progress on Trump's border wall project (file image), concluding that 42 miles of border barriers have been completed since he took office

Overall, just 110 miles of walls reflected in CBP's report consist of 'new' barriers where the US-Mexico border has previously been open to vehicle and foot traffic.

The rest are 'replacement' wall sections.

When a 'Fox & Friends' host asked White House Press Secretary Sarah Sanders on Wednesday how much of the wall is finished, she replied: 'There's over 100 miles. I think it's close to 115 miles.'

Trump downplayed the news about Thursday's disaster funding bill, saying at the White House that 'we’re going to get the immigration money later, according to everybody'.

Sen Richard Shelby, the Alabama Republican who chairs the Senate Appropriations Committee, told The Wall Street Journal that 'I’m sure he wanted the border, it’s humanitarian money, but we took it all out'.

'We’re going to try and push that separately when we come back.'

According to a chart in the report, the sections of the wall that are funded and in varying stages of contracting and completion include 86 miles of 'new primary wall' and 24 miles of 'new levee wall'.

Also included are 68 miles of 'replacement primary wall,' 144 miles of 'replacement vehicle wall' and 14 miles of 'replacement secondary wall'.

CBP breaks down the sources of funding that the US Army Corps of Engineers is using for construction contracts into three buckets.

The first two, adding up to '205 miles of new and updated border barriers,' are regular congressional appropriations and money shifted over from a Treasury Department fund that's flush with cash from the sale of forfeited assets like cars and real estate.

A separate Defense Department program that will build walls to block narcotics traffickers, according to CBP, will contribute another 131 miles of barriers.