The deployment of active-duty US soldiers and coastguard members at the US-Mexico border will be extended until September 30, according to the Pentagon.

Prolonging the mission past a January 31 deadline, the Pentagon said on Monday that it was "transitioning its support at the southwestern border from hardening ports of entry to mobile surveillance and detection, as well as concertina wire emplacement between ports of entry".

"DoD will continue to provide aviation support," the statement added, referring to the Department of Defense.

The deployment was supposed to end in mid-December, but the Department of Homeland Security asked that it be extended until January, a date which is now further prolonged.

The Pentagon already has about 2,350 active-duty troops stationed along the boundary.

They were deployed under a controversial order President Donald Trump gave last year before midterm elections in November as several thousand Central American migrants made their way to the border to seek asylum from violence and poverty in their own countries.

Some rank-and-file troops initially grumbled about the purpose of the mission to US media before they were placed under strict instructions not to voice personal opinions to the press.

Several soldiers the AFP news agency spoke to said their time on the border provided valuable real-world training, albeit without the risks of combat.

The soldiers' role had primarily been to erect miles of concertina-wire fencing along popular crossing points.

Critics decried Trump's order as a costly political stunt to galvanise supporters before the vote, in which his Republicans lost control of the House of Representatives.

Trump spoke of a "national emergency" and an "invasion" - initially suggesting US troops could shoot migrants if they threw stones at the US border.

The US military is not allowed, in almost any case, to get involved in domestic law enforcement and the border mission has put the supposedly non-political military in an uncomfortable spotlight.

About 2,200 national guardsmen were supporting border operations even before Trump sent the active-duty troops.