Hundreds of Central Americans from a new migrant caravan tried to cross into Mexico at the river that divides the country from Guatemala, but National Guardsmen fired tear gas to force them back.
The so-called "2020 Caravan" of around 3,500 undocumented migrants, gathered on the Guatemalan side of the Suchiate River, demanding migration authorities let them continue their journey to the United States.
When authorities did not immediately respond, people began wading across the river, which is shallow at this time of year.
Mexican troops fired tear gas to force them back, leading to scenes of chaos.
Scores of people, many with cloths tied around their faces to protect them from the gas, threw large stones at the military police guarding the southern border with large stones.
Dozens made it through the security cordon, but the majority were forced back.
Around 200 who made it through were later detained, authorities said.
An AFP correspondent saw large groups of them being rounded up along a road and loaded onto buses and trucks - some after trying and failing to run away.
Mexico's migration authority said the country was ready to welcome foreigners as long as they entered the country in a "lawful, safe and orderly" way.
The country also faces pressure from US President Donald Trump, who last year threatened to impose steep tariffs if it did not do more to stop a surge of undocumented Central Americans arriving at the US-Mexican border.
It is the first time Mexico has forcibly turned back a migrant caravan trying to cross the border river - a major change since the first massive caravan arrived in the country in October 2018.
That time, Mexico managed to contain thousands of migrants who tried to force their way across the official border bridge, but then did little to stop them when they illegally swam or took rafts across the river below.
Since then, thousands of Central Americans have crossed Mexico toward the United States in caravans, fleeing chronic poverty and gang violence in El Salvador, Guatemala and Honduras.
Seeking safety in numbers, many travel with small children in tow, often walking long distances.
After Mr Trump warned of an "invasion" and issued his tariff threat in May, the Mexican government deployed around 26,000 National Guardsmen to tighten its borders.
It has also allowed the US to send more than 40,000 asylum-seekers back to Mexico while their cases are processed, under the so-called "Remain in Mexico" policy.
Thanks at least in part to those measures, the number of undocumented migrants the US detained at its southern border fell more than 70% from May to December.
Mexican President Andrés Manuel Lopez Obrador, an anti-establishment leftist who came to office vowing to protect migrants' rights, offered last week to give 4,000 jobs to migrants in the new caravan if they stay in southern Mexico.
But Human Rights Watch accused Mexico of violating migrants' rights by failing to guarantee the security of those returned by the US and detaining others in "inhumane conditions."