WASHINGTON/GUATEMALA CITY (Reuters) - President Donald Trump threatened on Thursday to deploy the military and close the southern U.S. border if Mexico does not halt a caravan of Central America migrants heading north, raising the risk of huge disruptions to trade.

Stretching almost 2,000 miles (3,200 km), the U.S.-Mexican border is one of the busiest in the world, processing thousands of commuters daily and much of the half a trillion dollars of annual trade between Mexico and the United States.

“I must, in the strongest of terms, ask Mexico to stop this onslaught - and if unable to do so I will call up the U.S. Military and CLOSE OUR SOUTHERN BORDER!” Trump wrote on Twitter.

Several thousand Honduran migrants moved this week through Guatemala, and some were trying to cross to Mexico on Thursday, local media said. Some hope to eventually enter the United States to escape violence and poverty.

Mexico’s government said it had sought assistance from the United Nations refugee agency to deal with migrants claiming refugee status at Mexico’s southern border, one day ahead of a visit by U.S. Secretary of State Mike Pompeo to Mexico City.

On Friday, Pompeo will meet officials including outgoing President Enrique Pena Nieto, foreign minister Luis Videgaray and Marcelo Ebrard, the designated foreign minister of Mexican President-elect Andres Manuel Lopez Obrador.

Lopez Obrador, who takes office in December, said in the northern city of Saltillo on Thursday that he believed “an agreement can be reached” on the migration issue.

“We’re going to take care of our relationship with the United States government,” he said. “It’s very important to have a relationship of friendship.”

Trump told a political rally in Montana on Thursday night that he wanted “to thank the Mexican government because they are stopping it hopefully before it ever gets to Mexico.”

Foreign Minister Videgaray said his government had asked the United Nations High Commissioner for Refugees (UNHCR) to help process the migrants in order to guarantee transparency and so that Mexico could cope with a “higher volume of requests.”

“Later on, UNHCR could help the Mexican government to find places to settle (migrants) inside or outside Mexico for those granted refugee status, but that hasn’t been defined with UNHCR yet,” Videgaray told Reuters.

Mexico’s ambassador to Washington, Geronimo Gutierrez, told Fox News that seven migrants had already made requests to receive refugee status in Mexico.

Fox News reported on Thursday that Mexico and the United States had reached a deal on how to handle the migrant caravan.

Under this plan, if a migrant evaded the new system and traveled through Mexico into the United States, Mexico’s government would in future allow the person to be returned to Mexico, Fox News said, citing an unnamed official.

But foreign minister Videgaray said that was “false” and that no such deal had been made.

ELECTION ISSUE

In the caravan, Central American migrants hiked from Honduras through muddy jungle and residential streets, some toting babies along with backpacks, Reuters images show.

Slideshow ( 22 images )

In Guatemala City, where migrant shelters filled with people, waves of people departed at daybreak on roads leading to Mexico. The nearest border is about 110 miles (177 km) away.

“If we don’t get across, we’re going to try the same thing again,” said Gustavo Perez, a Honduran builder speaking at a shelter in Guatemala City.

“We hope that in this big caravan group, they let us in,” he added, referring to the United States.

Trump, who has vowed to curtail immigration and build a border wall on the U.S.-Mexico border, threatened this week to halt aid if Central American governments did not act.

Slideshow ( 22 images )

Illegal immigration is likely to be a top issue in Nov. 6 U.S. congressional elections and Trump said migrants in the caravan were being used by his political opponents.

“A lot of money has been passing to people to come up to try and get to the border by Election Day,” he said, without providing evidence.

Frustrated by Congress’ failure to fully fund his proposed wall, Trump in April ordered National Guard personnel to help secure the border in four southwestern U.S. states.

In a string of tweets, Trump also said the border issue was more important to him than the new trade deal with Mexico to replace the North American Free Trade Agreement.

“The assault on our country at our Southern Border, including the Criminal elements and DRUGS pouring in, is far more important to me, as President, than Trade or the USMCA. Hopefully Mexico will stop this onslaught at their Northern Border,” Trump wrote.

He was referring to the United States-Mexico-Canada Agreement, which is awaiting ratification.

U.S. Representative Michael McCaul, the Republican chairman of the House Homeland Security Committee, said U.S. border security was a key election issue.

“We have to secure that border once and for all,” McCaul told Fox News.

Lieutenant Colonel Jamie Davis, a Pentagon spokesman, said that while National Guard troops were currently supporting the Department of Homeland Security on the U.S. southern border, the Pentagon had not been tasked to provide additional support.

The caravan has been growing steadily since it left the violent Honduran city of San Pedro Sula on Saturday. There are no official estimates of the size of the group.

Guatemalan President Jimmy Morales on Wednesday dismissed threatened curbs to foreign aid, and said he had spoken with Honduran President Juan Orlando Hernandez about ensuring the migrants who want to return home can do so safely.

Ebrard, Mexico’s incoming foreign minister told local radio that he was not surprised by Trump’s comments.

“It was predictable, and it’s also very close to the election,” he said. “He’s making a political calculation.”