ILLEGAL immigration from Mexico is not quite a century old. A law of 1917 was the first to regulate the southern border. Stricter controls gradually followed all through the 20th century, often during the low points of a recurring cycle of sentiment towards immigrants. Economic booms have lured workers across the Rio Grande, encouraged by American firms. Downturns have led to demonisation of “wetbacks”. The 1930s and 1950s both saw indiscriminate mass-deportations; in 1976 President Gerald Ford wondered how best to “get rid of those six to eight million aliens who are interfering with our economic prosperity”.

The latest bout of Trumpian immigrant-bashing fits the mould in one respect: it comes on the heels of an economic downturn. But it is also strange, because the undocumented population levelled off after 2007. In 2015 there were just 188,000 apprehensions of Mexicans at the border, down from 1.6m in 2000 (see chart). This is partly because the recession reduced the magnetism of America’s labour market. But it also reflects a much more secure border—the number of border agents quintupled between 1992 and 2010—and changing demography in Mexico, where the birth rate has been falling since the early 1970s.
Nonetheless, undocumented immigrants still constitute 5% of America’s labour force.

Distinguishing their impact from that of other immigrants is hard, because they are tricky to identify. Instead, researchers typically just rely on nationality. There is almost no way for low-skilled Mexicans who lack American relatives to migrate north legally. As a result, Mexicans make up about half of all illegal immigrants, but only a fifth of all legal ones.

Mexicans tend to be less educated than other immigrants. In 2014 nearly 60% had less than a high-school education, compared with less than 20% of immigrants from other countries, according to the Pew Research Centre, a think-tank. Undocumented migrants are more likely than legal ones to work in unskilled occupations like services and construction.

There is a vigorous—and sometimes ill-tempered—debate among academics about the impact of low-skilled migration, both legal and illegal, on wages. Most recently this has centred on a dispute between two economists, David Card at the University of California, Berkeley, and George Borjas, at Harvard University, over the effect of an unexpected surge in Cuban migrants to Miami in 1980 (the so-called “Mariel boatlift”). In 1990 Mr Card found this influx had no effect on the wages of low-skilled workers in Miami; Mr Borjas has now revisited the analysis, and claims that wages of high-school dropouts in fact fell substantially.

This dispute, however, is only part of a much broader debate. Most other research finds that immigrant flows harm at least some workers, as economic theory usually predicts they should when immigration changes the balance of skills in an economy. The debate is over precisely who suffers, and how much.

The findings depend on two factors. The first is how to define unskilled workers. Mr Card and others like to include both high-school graduates and dropouts. In 2014, there were 64m such workers aged between 25 and 64 in America. Mr Borjas prefers to treat high-school dropouts separately in his research, so that the lowest-skilled migrants compete with fewer existing workers: 20m, at last count.

The second factor is whether, among those with similar education, migrants and native workers are substitutes or complements for each other. In 2011 a study by Gianmarco Ottaviano and Giovanni Peri, two economists, found that immigrants seem to compete mostly with other immigrants, even when controlling for age and education. One possible explanation is that unskilled natives respond to an increase in migration by specialising in work that makes better use of their command of English. Messrs Ottaviano and Peri concluded that between 1990 and 2006 immigration had a small positive effect on the wages of unskilled American-born workers, but reduced the wages of previous generations of migrants by 6.7%.

Mr Card says the “worst-case scenario” is that immigration has cut the wages of high-school dropouts by about 5% over 20 years, which, compared with the effect of technology and other trends, is not much. Mr Borjas says larger effects are possible. But everyone agrees that the more workers and new immigrants can substitute for each other, the more likely it is that immigration will change relative wages.

If the workers most comparable to illegal Mexican immigrants are legal ones, they will be most likely to have seen their wages depressed by illegal migration. Any such effect would probably have been compounded by the fact that firms who hire undocumented workers off-the-books need not pay them the minimum wage or adhere to other regulations. One survey of low-wage workers in Chicago, Los Angeles and New York in 2008 found that 37% of undocumented workers had been paid less than the minimum wage, compared with 21% of legal migrant workers.

Illegal migrants also may find it hard to move jobs, especially in states that require employers to check their papers. Their immobility could reduce their bargaining power. It certainly seems to stunt their wage growth. In 2009 Pew found that among those who had been in the country for less than ten years, legal migrants earned 18% more than illegal ones; among those with more than a decade under their belts, the gap was fully 42%. It is possible, though, that the wages of both these groups had still been dragged down relative to those of native workers.

The flipside of low wages for illegal immigrants, though, is greater economic benefits for those who are not competing with them for work. A rare study of the effect of illegal immigrants specifically found that in Georgia, a one-percentage-point increase in undocumented workers in firms boosted wages by about 0.1%. One explanation is that such firms benefit from a richer mix of skills within their workforce. Another explanation is that they are sharing the spoils of the savings that stem from hiring workers on the black market.

Were a President Trump to deport all illegal immigrants, the economy would suffer greatly. Just ask Arizona, where a crackdown on illegal immigrants in 2007 shrank the economy by 2%, according to a private analysis by Moody’s, a ratings agency, for the Wall Street Journal. The incomes of most workers would fall. Yet strangely enough, those best placed to benefit from a mass deportation would be those who had crossed the border legally.