Hundreds of migrants travelling across Central America in a mass caravan to the US have tried to breach Mexico's southern border and enter the country.
Some migrants broke through Guatemalan border fences but then clashed with Mexican riot police in no man's land.
On Friday, US President Donald Trump thanked Mexico for holding back the migrants from crossing into the US.
The migrants, mostly from Honduras, say they are fleeing violence and poverty, and include women and children.
Mr Trump, who has threatened to close down the US border, said the military would be called upon if needed.
"They might as well turn back, they're not coming into this country," he told reporters on Friday.
After talks on border security in Mexico, Secretary of State Mike Pompeo said the situation was reaching "a moment of crisis".
What happened on the border?
Hundreds of Central American migrants broke through barriers on a bridge which crosses the river border between Guatemala and Mexico.
Dozens of Mexican police in riot gear reportedly fired tear gas to force them to retreat into no-man's land after being attacked with stones.
The Mexican authorities have told migrants, who include women, children and old people, they want an orderly process and only those with valid documents will be allowed in.
On Thursday, Mr Trump thanked Mexico in a tweet for the decision to send hundreds of police officers to meet the migrant caravan at the border.
Mr Trump has also threatened to cut aid to countries allowing the caravan to pass.
A number of migrants jumped into the Suchiate river to reach rafts, while others either turned back towards Guatemala or simply sat down on the bridge.
Why is Trump concerned?
Since his campaign days, Mr Trump has lambasted illegal immigrants, and this latest caravan comes after a major immigration crackdown.
Changes to detention rules saw thousands of migrant children detained and separated from their parents at the US-Mexico border earlier this year, sparking national and international condemnation.
Mr Trump's threats come weeks before the mid-term elections on 6 November, which could see Democrats unseating Republicans in the House of Representatives.
According to a Kaiser Foundation poll, immigration is the most important issue for 15 percent of all voters, though the number jumps to 25 percent among Republican voters.
Could Trump close the US-Mexican border?
....In addition to stopping all payments to these countries, which seem to have almost no control over their population, 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!..— Donald J. Trump (@realDonaldTrump) October 18, 2018
While Mr Trump has sent National Guard troops to the border before, it is unclear what he means by shutting it down entirely, and whether that would affect businesses or people with legitimate visas.
And according to international law, the US cannot deport asylum seekers without first determining the validity of their claim.
Andrew Selee of the Migration Policy Institute told the BBC that closing the border "would wreak havoc on Mexican and American economies".
"It could be a symbolic effort," he adds. "A way of pressuring Mexico - but that would have a limited effect on illegal crossings and a huge effect on legal crossings."
Where is the caravan now?
The migrant caravan is currently in Guatemala, in the border town Tecún Umán, though some in the group have already crossed into Mexico.
Their journey of nearly 4500km - mostly on foot - began in San Pedro Sula, Honduras, last Friday.
What will happen to the people?
Mexican officials have said that those without papers would have to apply for refugee status or turn back.
The Associated Press news agency says many migrants do not have passports and have been using national ID cards, which allow them to travel within Central America. Mexico, however, requires a passport at entry.
Human rights groups have criticised the US and Mexican response to the caravan.
Erika Guevara-Rosas of Amnesty International said in a statement: "These families deserve dignity and respect to ensure that no-one is illegally returned to situations where they could risk serious harm due to violence."
Mexican President-elect Andrés Manuel López Obrador has promised to offer work visas to Central Americans when he takes office in December.
Mr Selee said Mexico would "try to defuse the crisis" the same way they did with the last migrant caravan: by giving some people legal status or the chance to apply for asylum and deporting others.
Why are they leaving?
An estimated 10 percent of the population of Guatemala, El Salvador and Honduras have fled danger, forced gang recruitment and dismal economic opportunities.
The region has one of the highest murder rates in the world. The UN reported murder rates in 2015 in Honduras standing at 63.75 deaths per 100,000 and El Salvador at 108.64 deaths.
Jari Dixon, an opposition politician in Honduras, tweeted on Monday that the caravan was not "seeking the American dream" but "fleeing the Honduras nightmare".
In a statement on Tuesday, Honduras' foreign ministry urged its citizens to "not let themselves be used by a movement that is clearly political and seeks to disrupt the governability, stability and peace".
Voices from the caravan
BBC journalists spoke to some of the migrants travelling with the caravan as they wait at the border.
Francisca: I joined the caravan because I was afraid to come on my own but I want my children to have a better life than me. In Honduras, there is no work, there is nothing. They killed my husband, they stabbed him, disfigured him. I call on the US and Mexico to help us, because I am not a woman who needs handouts. God is going to soften Trump's hard heart.
Maria: I am from Potrero, Cortés, Honduras. Only God knows where we will end up. I have a husband but it's almost as if I don't have one. I have four children, two in Honduras and two that I brought with me. If the Honduran President was more responsible, there wouldn't be so much emigration, but there are no jobs. The violence stays the same. Trump is saying that if there are immigrants crossing into the US they'll send us back to Honduras. What have we ever done to him? He should be happy because we're going to work.