CIUDAD TECÚN UMÁN, Guatemala — Members of a caravan of migrants that have been traveling from Honduras toward the United States, infuriating President Trump, overran a border gate in northern Guatemala on Friday and broke through another gate leading to Mexico before coming to a halt in the face of a large phalanx of Mexican riot police.

After a tense hourlong standoff, during which migrants hurled objects at the police, including rocks and shoes, the police fired canisters of tear gas, forcing the migrants into a retreat.

At least six police officers were wounded in the confrontation, officials said.

After the violence had subsided, however, leaders of the caravan organized the migrants into orderly lines for processing by Mexican migration officials. By midafternoon, the migrants were gradually being allowed into Mexico, where they boarded buses, some to a migration center in the city of Tapachula for processing and others to a government shelter, said Manelich Castilla Craviotto, general commissioner of the Federal Police. It remained unclear how long it would take the authorities to register all the new arrivals.