WASHINGTON — More than 5,000 active-duty military troops will deploy to the southern border by the end of this week, Defense Department officials said on Monday, an escalation of a midterm election show of force against a caravan of Central American migrants that President Trump has characterized as an “invasion of our country.”

The massing of American troops comes as Mr. Trump has seized on the caravan as a closing political message in the final week before the midterms, warning darkly — and without evidence — that “Middle Eastern” people are part of a dangerous mob of migrants threatening to surge into communities here.

But the caravan, which has shrunk from 7,000 people to less than 3,500, is still weeks away from reaching the United States. The rare use of the active-duty military to bolster Mr. Trump’s campaign message has intensified criticism that the president is using the military for political gain.

“This is using the troops as props,” said Jason Dempsey, who served as an Army infantry officer in Iraq and Afghanistan and is now an adjunct senior fellow at the Center for a New American Security. “We’re using a bunch of people to waste their time while they backstop the Border Patrol.”