In Lampedusa ten days ago, the air was not only full of the stench of the decaying bodies of drowned Africans—men, women, and children—it reeked of hypocrisy. Having set up impassable bureaucratic barriers even for those desperately seeking asylum, Italian politicians bemoaned the loss of innocent lives, and even declared a national day of mourning.

Italy also broadcast a loud call for help from the EU to deal with the waves of unwelcome immigrants that have hit its shores—17,000 in the first eight and a half months of this year. How could Italy, a country of 61 million people and the world’s fifth-largest manufacturing nation, whose sons and daughters not long ago populated much of the new and old world with emigrants, possibly deal with such a massive invasion?

Italy’s Northern European partners, having made sure that the responsibility for dealing with Africans arriving illegally on Europe’s shores lies with the port of entry—inevitably located in the Mediterranean—immediately expressed sympathy. But, as governments across Europe continue to pander to right-wing anti-immigration parties, don’t hold your breath for change.

Other large advanced countries, such as the United States and Japan, may be relieved that they do not often have to confront such highly visible catastrophes as large boats full of immigrants sinking near their shores. But their policies are no better.

Japan essentially prevents immigration, period. The United States allows in large numbers only through reunification schemes for the families of those who are there legally. If you have a million dollars to spare, you can enter as an investor.

Skilled workers allowed into the United States temporarily for work represent just a trickle, and, unless they win the lottery, unskilled workers can forget about immigrating legally for work. So they enter illegally instead, for the most part crossing dangerous deserts and bypassing huge fences instead of braving stormy seas.

The extraordinarily restrictive immigration policies of rich countries are motivated in part by xenophobia, and in some cases by simple racism. But those policies are also the result of faulty economic thinking—the belief that immigration hurts the host countries’ collective wallets.

Let’s ignore the big gains that accrue for those who are able to migrate, who can triple or quadruple the miserly wages they can expect at home. Let’s also forget about the estimated $410 billion of remittances that migrants will send home this year to the world’s poorest countries. That is hard-earned money that hugely outstrips foreign aid, develops markets, and helps millions avoid destitution.

Let’s focus only on what the neediest migrants—the uneducated from Africa or Central America—do directly for the citizens of rich countries.

These unskilled migrants do not compete directly with unskilled natives for jobs, as the newcomers do not speak good English or Italian, and they will gladly take on the dirtiest and toughest jobs to get by. But they often enable unskilled natives to take on a more highly paid job such as foreman or supervisor. They expand markets and lower costs for entrepreneurs and owners of capital.

Unskilled migrants also stimulate demand and investment in key sectors such as housing, healthcare, and transportation. They reduce the cost of providing essential services such as household chores or caring for children and the elderly, freeing up the highly educated to work for good wages. And they are essential in labor-intensive sectors such as agriculture, construction, and garments.

Immigrants boost economic efficiency because of the scale, specialization, and flexibility they contribute to production. If allowed to come and go legally, they tend to moderate the impact of business cycles on natives: migrants come when times are good, and leave or don’t come at all when times are bad.

Migrants also have a minimal impact on government budgets. If they are young, as many are, and employed legally, they tend to pay more in taxes than they derive in benefits. If they are allowed and encouraged to integrate, as they are in the United States, far from creating a permanent underclass, their children tend to achieve higher levels of education than the children of natives.

As Europeans get richer and older, they need immigration, not just of the skilled, but also—and in larger numbers—of the unskilled. Moreover, immigration tends to be self-regulating: immigrants, like everyone else, will not pack their bags, leave their families, and move hundreds of miles if they don’t think they can get a job.

So, fixing today’s abysmal and uncoordinated European immigration policies requires two steps.

The first is to legalize those immigrants already here and allow a sufficient number of those who want to come to enter legally. The second, equally crucial, step is to make sure that employers observe regulations and hire only migrants with work permits. If employers observe the minimum wage, and that wage is enough to secure a decent living, the demand for immigrant labor will be contained, just as for any other laborer.

It will be clear that Europe’s immigration policies are beginning to work when there are fewer fatalities at the EU’s borders, and more employers are paying hefty fines for hiring undocumented migrants.