No one believes in entirely closed borders. Every country in the world requires and allows immigration: to succour the truly vulnerable, to reunite families and to fill vital gaps in their workforces, whether for Python coders or hospital bottom-washers. But no one seriously believes in completely open borders either, if by that one means letting in anyone who turns up.

Germany got a taste of what that would mean in 2015, when Chancellor Angela Merkel decided to welcome a stream of asylum-seekers arriving at its borders from Syria and elsewhere via Turkey and Lebanon. Under the threat of a political backlash to the arrival of more than 1m people, many of whom were technically economic migrants, and despite her pledge that “we will manage this”, she promised during last year’s election that “what happened in 2015 cannot, should not and must not happen again.”

So how to draw the line between open and closed? A lot is at stake.

Matteo Salvini, Italy’s hard-right interior minister, deputy prime minister and leader of its Northern League, is surging in the popularity polls. Mr Salvini is likely in due course to become Italy’s leader in large part because of his uncompromising stance on immigration. “People whose only contact with immigrants is with the Filipino servant who takes the dog for a walk in the evening are in favour of immigration, but they have no idea of how immigration is lived in the peripheries,” he said in July.

That, in a nutshell, is the charge made against smug liberals who champion “open borders”. They get all the benefits of large-scale migration from low-wage countries: cheap nannies, Uber drivers, decorators, waiters, sandwich-makers, chambermaids and dog-walkers. But they don’t rely on public housing, tend to have private health-care and often pay for private education so that their children are not brought up in classes where, in some cases, their native tongue is spoken by a minority.

Meanwhile those locals not so fortunate as the cosmopolitan elite (who kid themselves that they deserve their good fortune because they worked hard, ignoring that they started life on third base) often compete with people who will work for less because they are prepared to live in dorms or bedsits, having left their families at home.

It is a crude oversimplification. Economically, migrants are a net plus. European Union migrants in Britain, for example, typically contribute more in taxes and take less in benefits than the natives they ostensibly “compete” with. In global utilitarian terms, the benefits of migration to the migrants themselves are much greater than the downside, if indeed there is one, to the native-born. For the host country, more labour means a bigger economy, so that more money is available to be spent on the schools, hospitals and houses needed to accomodate the newcomers (though in these straitened times the money is often not spent on doing that). The liberal case for more immigration is pretty clear.

The trouble is, many liberal leaders forgot to ask citizens if they wanted large-scale migration from distant lands. And it turns out that a large number of them did not.

A small club of comfortable internationalists, insulated by their wealth, accuse them of xenophobia and ignorance. A much larger number of people—dubbed the “Somewheres” by the British writer David Goodhart, in contrast to the “Anywheres”, who feel a more global sense of loyalty—are concerned to protect their culture, are resistant to rapid change, and, outrageously enough, care more about their own people than the citizens of the rest of the world. Most of all, though, they tend to feel they have nothing to justify. Why should self-serving liberals’ opinions trump theirs? Do liberals not believe in democracy?

It often seems that liberals disdain democracy when its outcomes clash with their views. Yet before they accuse half their fellow citizens of bigotry, they might want to stop and think about just who is being intolerant. Too often they don’t. Hence, the rise of Donald Trump, Mr Salvini, Viktor Orban in Hungary and Jaroslaw Kaczynski in Poland. If they want to stop losing in the political arena, liberals need to try a bit harder to understand the views of those unlike themselves.

For immigration, that means calibrating the numbers coming in to what the host country will accept. It also means making sure that enough is spent on housing, schools and hospitals to absorb the influx without harming services to existing citizens (and this will probably require higher taxes). It means investing in training locals and paying them better wages. Most of all, it will mean remembering that a sense of culture and tradition does matter.

If this is done, the affluent may be able to keep their dog-walkers. If it’s not, they may lose much more than that.