US politicians have announced an agreement in principle to avoid another government shutdown, with nearly $1.4bn in money for construction of a wall on the border with Mexico.

It came as US President Donald Trump pushed his politically explosive crusade at a rally in the frontier city of El Paso.

That amount is far less than Mr Trump has demanded. But if accepted, the deal would avert another chaotic standoff in which Mr Trump has threatened to cut budgets from swaths of government this Friday.

Senator Richard Shelby, a key Republican negotiator, told reporters an agreement in principle had been reached between Republicans and Democrats.

Senior congressional aides said the agreement included $1.375bn in funding for a wall on the US-Mexico border, a key campaign promise of Mr Trump, who had demanded $5.7bn for his pet project.

The agreed figure would fund approximately 89km of wall, all to be located in the Rio Grande Valley area of south Texas, the aides said.

The deal still faces White House approval.

The news came as Mr Trump was about to climb the stage in the El Paso arena and the president, addressing a raucous crowd, said he did not have enough details to respond.

"We probably have some good news but who knows," he said.

Addressing thousands of people, many wearing his red "Make America Great Again" campaign hats, Mr Trump said: "We need the wall and it has to be built and we want to build it fast."

According to Mr Trump, illegal immigrants pose a national security risk to the United States and can only be stopped by dramatic extensions of current barriers.

It is an argument he backs up with lurid warnings about rapists and people traffickers extending far into the American heartland - a message that critics describe as xenophobic and based on heavily manipulated data.

The border controversy is the opening battle of Mr Trump's 2020 re-election bid and his El Paso rally gave a taste of things to come.

He chose the setting as a historic crossing point where he says walls have successfully halted an out-of-control influx of Mexican criminals.

"Walls save lives, walls save tremendous numbers of lives," he said.

There was a counter-message a short distance from where Trump spoke when rising Democratic star Beto O'Rourke, a possible challenger in 2020, held his own rally.

A former congressman who excited grassroots Democrats last November with an against-the-odds near upset of Republican Senator Ted Cruz, O'Rourke is from El Paso.

"Tonight, we will meet lies and hate with the truth and a positive, inclusive, ambitious vision for the future from the US-Mexico border," he said.

Mr Trump dismissed O'Rourke as "a young man who's got very little going for himself except he's got a great first name".

Making fun of what he said was Mr O'Rourke's much smaller crowd, Mr Trump said: "That may be the end of his presidential bid."

The wall debate has deepened the already gaping rift between left and right since Mr Trump's election.

The president has certainly failed to persuade Congress to fund his wall project, with Democrats accusing him of using the whole issue to boost his political base, rather than fix the complex border situation.

Mr Trump, fearing a humiliating defeat on his signature issue, has fought back fiercely.

In December, he pushed back at Congress by refusing to fund large sections of the government, leading to a five-week shutdown of some 800,000 federal jobs.

Next, he gave Congress until Friday to come up with the wall money or face another shutdown.

Alternatively, Mr Trump could declare a national emergency, giving himself power to take the money from the military, although this would likely provoke lawsuits and even more political recriminations.