A caravan of Central American migrants whose trek across Mexico infuriated Donald Trump on Wednesday scrapped plans to cross into the United States, as the American president ordered the National Guard to deploy to the border.

Reports on the caravan had triggered four days of Twitter diatribes from Trump, who threatened to axe the North American Free Trade Agreement (NAFTA) if Mexico did not stop the migrants.

Briefing media at the White House on Wednesday, US Homeland Security Secretary Kirstjen Nielsen announced that Trump had ordered the National Guard to deploy to assist the border patrol in the southwestern United States.

Caravan leaders said most of the group -- about 80 percent -- would now remain in Mexico, where authorities are working with individual migrants and families to get them temporary papers.

"All they want is a place to live in peace, where they can work without having guns pointed at them, without being forced to join a gang," said Irineo Mujica, the head of migrant advocacy group People Without Borders (Pueblo sin Fronteras).

A handful of migrants with strong claims for asylum will continue to the US border on their own, he said.

He praised the Mexican government for its response.

"Donald Trump wanted the world to crush us, to erase our existence. But Mexico responded admirably and we thank the government for the way it handled this caravan," he told AFP in the town of Matias Romero, in the southern Mexican state of Oaxaca.

The just over 1,000 migrants who currently make up the caravan -- many traveling in families of up to 20 people -- have been camped in this southern town since the weekend, deciding their next move.

The group, mainly Hondurans, also includes Salvadorans, Guatemalans and Nicaraguans, mostly fleeing the brutal gang violence that has made Central America home to some of the highest murder rates in the world.

They have set up camps in parks and athletic fields, sleeping on flattened cardboard boxes or blankets spread on the ground, many using their scarce belongings as pillows.

The caravan is in fact a yearly event held since 2010. Its goal is more to raise awareness about the plight of migrants than to reach the United States -- though some participants have traveled to the border in the past.

Mujica said this year's trek was complicated by the caravan's size.

"There are too many children -- 450 in all. There are lots of babies. Hopping the train, as we did in the past, would have been crazy," he said.

The caravan, which set off on March 25 from Tapachula, on the border with Guatemala, now plans to travel to the central city of Puebla for a conference, then on to Mexico City for a series of demonstrations -- and end its journey there.

Some of the migrants -- mainly those traveling with children -- will receive 30-day visas giving them time to apply for refugee status in Mexico.

Others are receiving 20-day transit visas giving them time to return home legally -- though many are expected to stay in Mexico illegally or push on to the United States.

The Mexican government, which bristled at Trump's criticism and his move to militarize the border, said Monday it was up to the United States to decide whether to admit such arrivals or not.

Many of the migrants say they have no intention of trying to enter the US.

Carol Torres, a 26-year-old Honduran woman, told AFP she joined the caravan after her abusive husband hired gang hitmen to attack her, forcing her to leave her two children behind.

She said she planned to settle in Tijuana, on the Mexican side of the border -- not cross into the United States.

"I don't believe in the American dream, because the president over there is a son of a bitch who doesn't like immigrants," she said.

Mexico's former foreign minister, Jorge Castaneda, called Trump's reaction to the caravan "a little hysterical," telling Mexican radio network Formula that he suspected the US president was more worried about his Republican party losing this November's mid-term elections than the migrants.

"He's just mobilizing his conservative base," he said.