Media playback is unsupported on your device Media caption Trump and the facts about the migrant caravan

The Pentagon is sending over 5,200 troops to the border with Mexico as thousands of Central American migrants walk towards the US in a caravan.

General Terrence O'Shaughnessy said Operation Faithful Patriot would focus on Texas, Arizona and California.

President Donald Trump earlier said the "invasion" of migrants would find the US military waiting for them.

He also told Fox News that "tent cities" would be built to house migrants seeking asylum in the US.

"If they apply for asylum, we're going to hold them until such time as their trial takes place. We're going to hold them, we're going to build tent cities, we're gonna build tents all over the place," he said in an interview on Monday.

There are already 2,100 National Guard members at the border, sent after a previous request by Mr Trump in April.

Both sides of the US political divide have been accused of using the migrants for electoral gain just a week before Americans go to the polls.

In mid-term elections on 6 November, President Trump's Republican Party will seek to keep both houses of Congress out of Democratic hands.

The migrants are still around 1,000 miles (1,600km) from the US border.

Gen O'Shaughnessy said the troops would be deployed by the end of the week with weapons, helicopters, aeroplanes, barriers and miles of razor wire to support border patrol agents.

Why the urgency?

Analysis by Anthony Zurcher, BBC News, Washington

After a week in which guns and bombs dominated the headlines, Donald Trump seeks to return the focus on the migrants making their way through Mexico toward the US border.

Their numbers may be dipping thanks to an offer of Mexican asylum and the length of the journey, but the president is sounding the alarm.

The deployment of 5,000 soldiers to the border will probably have little tangible impact, given that the migrants plan to file legal requests for asylum.

The urgency is questionable as well, given that it could be months before they arrive at the border.

What the announcement represents, however, is clear. The president seeks to paint the refugees as a national threat that he alone is willing to counter.

At the moment immigration is not among the top concerns of American voters. The president, perhaps seeking political advantage, has eight days to change that.

US Customs and Border Protection (CBP) commissioner Kevin McAleenan also addressed Monday's news conference.

He told reporters the migrants were estimated to be several weeks away from reaching the US border.

The figure of 5,200 military personnel is higher than the 800 troops it was initially predicted would be sent.

The total military deployment means the number of troops at the south-western border will exceed the US troops currently in Syria and Iraq, the Wall Street Journal notes.

Image copyright AFP

Mr Trump tweeted on Monday: "Many Gang Members and some very bad people are mixed into the Caravan heading to our Southern Border.

"Please go back, you will not be admitted into the United States unless you go through the legal process.

"This is an invasion of our Country and our Military is waiting for you!"

Many of the migrants say they plan to seek asylum in the US.

Image copyright AFP Image caption US riot police in a drill at the US-Mexico international bridge

There is a legal obligation under international law to hear asylum claims from migrants who have arrived in the US if they say they fear violence in their home countries.

Those seeking asylum must be fleeing due to a serious fear of persecution in their home country. Under international law, these are considered refugees.

If an asylum seeker enters the US illegally, they are still entitled to a hearing of their claim.

Image copyright AFP Image caption Mostly Honduran migrants cross a river that separates Guatemala and Mexico on Monday

Economic migrants are those seeking a better quality of life - and even if they are fleeing devastating poverty, they are not considered refugees and do not have the same protections.

Mr Trump is not the first president to send troops to the border with Mexico.

President Barack Obama sent some 1,200 National Guard soldiers to guard the boundary, while President George W Bush deployed about 6,000 troops to help Border Patrol in what was called Operation Jump Start.

Both deployments lasted for about a year.