FOR years migrants have left Guatemala, El Salvador and Honduras—Central America’s so-called “Northern Triangle”—to pursue their dreams in the United States. Having fled civil wars between the 1970s and 1990s, they now flee poverty and gang-related violence. Over 3m Central Americans are reckoned to live in America. But this year the flow of migrants out of the Northern Triangle and into the United States has slowed. Some have postponed or even cancelled their odysseys. Others are staying put in Mexico. Why?

In the 1970s the Mexican government, worried about jobs, education and health care, introduced laws that restricted entrance to “useful” migrants. Between 1974 and 2008 it was a criminal offence to enter or stay in Mexico without authorisation. The country is more open now, but Central Americans have tended to ignore its potential as a place to make a new home, and headed farther north. In October 2016 more than 66,000 migrants were apprehended at America’s southern border, around half of them Central American. By April that figure had dropped to 16,000. At the same time the number of undocumented migrants caught by Mexico’s immigration police was also dropping. Meanwhile, the number of asylum-seekers in Mexico rose from 9,000 in 2016 to 7,000 in the first half of 2017 alone. Under Mexican law asylum is granted to those persecuted on the grounds of race, religion, nationality, gender, membership of a particular social group, or political opinion. The definition of social group can be quite flexible, so being part of a family that has been threatened by a gang could be the basis for a claim. Last year 63% of applicants were granted asylum, up from 40% in 2014.

The changes in migrant flows were inspired by the election of Donald Trump and the accompanying shift in America’s approach to migration. On the campaign trail Mr Trump spoke of deporting the 11m undocumented migrants believed to live in the United States. He may have softened that stance somewhat since taking office, but he has placed temporary limitations on America’s refugee programme and has continued to promote the building of a border wall. Such steps do not go unnoticed by would-be migrants, and Mexico’s appeal has increased as a result. It has other, older attractions to asylum-seekers too: it is closer to the Northern Triangle than is the United States, it is culturally and linguistically more familiar and it processes asylum claims faster.

But Mexico is no migrant paradise. The government needs to work out how to deal with and respect the rights of the burgeoning number of new arrivals. The violence suffered by undocumented migrants in the country, described as “chronic” in a recent report by the Washington Office on Latin America, an NGO, shows no signs of letting up, despite the establishment of a dedicated unit to investigate such crimes. More money is needed for counselling, shelters, staff training and for COMAR, the commission responsible for the welfare of asylum-seekers. And Mexico needs to show this largesse while retaining focus on the longer-term goal: economic development. Violence and poverty in the region are intimately linked with migration. Strengthening local economies would reduce the human flow too.