The two neighbors have been at odds since United States President Donald Trump on May 30 threatened to hit all Mexican imports with steadily rising tariffs unless Mexico successfully halted the northward flow of Central American migrants fleeing extreme poverty and violence through Mexico toward the United States.

Approximately 80% of Mexican exports are destined for the United States. Tariffs would have devastated Mexico's economy.

To keep its goods untaxed, Mexico had to convince President Trump that it was serious about stopping migration. After a week of frantic negotiations, Mexico said it woulddeploy up to 6,000 National Guard troops to its southern border with Guatemala to stop migrants from entering Mexico.

At a June 8 rally "for the dignity of Mexico and friendship with the U.S." held in the border city of Tijuana, Lopez Obrador pledged that Mexico will reinforce its southern border while still "applying the law and respecting the human rights" of migrants.

Ebrard added at the rally that Mexico had emerged from a near trade war with its "dignity intact."

Many Mexican lawmakers, including allies of the president, have expressed outrage that their immigration policy is now bound by an "immoral and unacceptable" deal that effectively turns Mexico itself into Trump's border wall.

According to international refugee law asylum-seekers with demonstrable fear of persecution in their home countries are entitled to seek protection in the place of their choosing. Mexican law goes further. As of 2011, legitimate asylum-seekers are entitled not just to seek but to be granted asylum in Mexico.

Even before the recent negotiations, Lopez Obrador was already quietly complying with U.S. demands to do more to prevent migrants from reaching the U.S.

Between January and May of this year, Mexico detained 74,031 migrants - a 36% increase compared to the same period last year under former Mexican president Enrique Pena Nieto. The number of migrants deported from Mexico tripled from 5,717 in December 2018 to 15,654 in April 2019, government statistics show.

Sending troops out to target migrants, as Mexico has now promised to do, will almost certainly result in the excessive use of force against these migrants.

Between 2007 and 2017, when troops were helping police fight Mexican drug cartels, the National Human Rights Commission received over 13,700 complaints of human rights violations committed by soldiers against civilians. These included accusations of arbitrary arrests, torture and extrajudicial killings.

Under such an agreement, refugees are required to apply for asylum in the country where they first land and not the country where they ultimately want to settle. This means that one country can reject a person's asylum application if they have already been granted asylum by another country.

Canada and the U.S. signed such an agreement in 2002, and Trump has been pushing Mexico to do the same since spring 2018. Under this proposal, thousands of migrants in Mexico who have already applied for asylum in the United States and are now waiting for an answer would see their applications invalidated.

Dozens of Central Americans have disappeared from migrant caravans journeying northward in Mexico. Over 90% of migrants say they do not feel safe in Mexico, according to a survey of 500 Central American asylum-seekers conducted in February 2018.

Mexico must do more with less

The "Remain in Mexico" policy is likely to result in a significant increase in claims filed for asylum in Mexico, where the immigration system is already under enormous strain.

Around 29,000 people applied for asylum in Mexico in 2018, according to United Nations data. This year, between January and March, Mexico received 12,716 asylum applications - 43% of last year's total in just three months.

The Mexican Commission for Refugee Assistance, which processes asylum claims, currently has a two-year backlog.

It will now have to do more with less.

Under Lopez Obrador's austerity policies, the commission's 2019 budget was cut 20%, to about US$1 million - its lowest budget since 2011.

More migrants, less money, extreme violence and a recalcitrant, unpredictable northern neighbor - these are the ingredients of a refugee crisis, not a diplomatic victory.