TECUN UMAN, Guatemala -- Migrants travelling in a mass caravan burst through a Guatemalan border fence and streamed by the thousands toward Mexican territory on Friday, defying Mexican authorities' entreaties for an orderly crossing and U.S. President Donald Trump's threats of retaliation.

On the Mexican side of a border bridge, they were met by a phalanx of police with riot shields. About 50 managed to push their way through before officers unleashed pepper spray and the rest retreated.

The gates were closed again, and police used a loudspeaker to address the masses, saying, "We need you to stop the aggression."

Mexican federal police chief Manelich Castilla, speaking from the border town of Ciudad Hidalgo, told Foro TV that his forces achieved their main objective of preventing a violent breach by the 3,000-plus migrants. In a separate interview with Milenio television, he accused people not part of the caravan of attacking police with firecrackers and rocks.

"It will be under the conditions that have been said since the start," Castilla said. "Orderly, with established procedures, never through violence or force as a group of people attempted."

The chaos calmed somewhat as migrants formed lines in a mass of humanity stretching across the bridge. Some returned to the Guatemalan side to buy water and food.

But others, tired of waiting, jumped off the bridge into the Suchiate River. Migrants organized a rope brigade to ford its muddy waters, and some floated across on rafts operated by local residents who charged a dollar or two to make the crossing.

Cristian, a 34-year-old cellphone repairman from San Pedro Sula, said he left Honduras because gang members had demanded protection payments of $83 a month, a fifth of his income. It was already hard enough to support his four daughters on the $450 he makes, so he closed his small business instead.

Cristian, who declined to give his last name because the gangsters had threatened him, estimated that about 30 per cent of the migrants want to apply for refugee status in Mexico, while the rest want to reach the United States.

"I want to get to the States to contribute to that country," Cristian said, "to do any kind of work, picking up garbage."

Two buses arrived to transport women, children and the elderly to be processed by Mexican immigration authorities. But the migrants refused to board, fearing they would simply be deported.

"Walk! Walk!" they chanted, insisting they be allowed to continue on foot.

Earlier in the day, thousands of migrants, some waving Honduran flags and carrying umbrellas to protect against the sun, arrived at the Guatemalan side of the river, noisily demanding they be allowed to cross.

"One way or another, we will pass," they chanted, climbing atop U.S.-donated military jeeps parked at the scene. Young men tugged on the fence, finally tearing it down, prompting the huge crowd of men, women and children to rush past and over the bridge.

Edwin Santos of San Pedro Sula was one of the first to race by, clutching the hands of his father and wife.

"We are going to the United States!" he shouted. "Nobody is going to stop us!"

Acner Adolfo Rodriguez, 30, one of the last through, said he hoped to find work and a better life far from the widespread poverty and gang violence in Honduras, one of the world's deadliest countries.

"May Trump's heart be touched so he lets us through," Rodriguez said.

The U.S. president has made it clear to Mexico that he is monitoring its response. On Thursday he threatened to close the U.S. border if Mexico didn't stop the caravan. Later that day he tweeted a video of Mexican federal police deploying at the Guatemalan border and wrote: "Thank you Mexico, we look forward to working with you!"

Mexican officials said those with passports and valid visas -- only a tiny minority of those trying to cross -- would be let in immediately.

Migrants who want to apply for refuge in Mexico were welcome to do so, they said, but any who decide to cross illegally and are caught will be detained and deported.

U.S. Secretary of State Mike Pompeo met Friday with President Enrique Pena Nieto and Foreign Relations Secretary Luis Videgaray in Mexico City, with the caravan high on the agenda.

At a news conference with Videgaray, Pompeo called illegal migration a "crisis" and emphasized "the importance of stopping this flow before it reaches the U.S. border," while also acknowledging Mexico's right to handle the crisis in a sovereign fashion.

"Mexico will make its decision," Pompeo said. "Its leaders and its people will decide the best way to achieve what I believe are our shared objectives."

At Mexico City's airport before leaving, Pompeo said four Mexican federal police officers had been injured in the border standoff and expressed his sympathy.

On Thursday, Videgaray asked the U.N. for help processing what Mexico expects to be a large number of asylum requests.

But Jose Porfirio Orellana, a 47-year-old farmer from Yoro province in Honduras, said he has his sights set on the United States due to woeful economic conditions in his country.

"There is nothing there," Orellana said.

Migrants have banded together to travel en masse regularly in recent years, but this caravan was unusual for its huge size, said Victor Clark Alfaro, a Latin American studies professor at San Diego State University. By comparison, a caravan in April that also attracted Trump's ire numbered about 1,000.

"It grabs one's attention that the number of people in these kinds of caravans is on the rise," Clark Alfaro said. "It is migration of a different dimension."

Elizabeth Oglesby, a professor at the University of Arizona's Center for Latin America, said people join caravans like this because it's a way to make the journey in a relatively safe manner and avoid having to pay thousands of dollars to smugglers. She disputed Pompeo's claim that migration is a "crisis."

"Yes, we are seeing some spikes in Central Americans crossing the border, but overall migration is at a 40-year low," Oglesby said.

Speaking on the Televisa network, Videgaray did not seem concerned about Trump's threat to close the U.S.-Mexico border, saying it had to be viewed in light of the hotly contested U.S. midterm elections, in which Trump has made border security a major campaign issue.

Videgaray noted that 1 million people transit the border legally every day, and about $1 million in commerce crosses every minute.

"Before taking decisions of that kind," Videgaray said, "there would be many people in the United States ... who would consider the consequences."