The European Union has been devoted to eliminating borders, and now finds itself functionally with none amidst its worst refugee crisis since World War II.

To paraphrase Stalin, the migrant crisis stopped being a statistic — more than 2,000 migrants have drowned this year — and became a tragedy with the heart-rending images of a dead 3-year-old Syrian boy washed up on a Turkish beach.

The scale of the crisis is mind-boggling.

About a million people left Russia after the 1914 revolution. In Syria alone, about 4 million people have fled the country, and another 7 million have been internally displaced.

Refugees and migrants are also coming from Iraq, Afghanistan, Libya and other hopeless places, adding up to potentially tens of millions of migrants.

The locus of the migrants’ hopes, more than anywhere else, is Germany. It is expected to get 800,000 asylum claims just this year.

The government is talking of taking 500,000 migrants annually for the next several years, and Chancellor Angela Merkel calls the crisis “the next great European project.” The reaction of the rest of Europe should be, no thanks.

What Germany is proposing is undertaking a vast social and demographic experiment, with the rapid, bulk importation of Muslim immigrants into a country with an aging population.

Other European countries could be forgiven for not being so adventurous. The experience of the French banlieues, home to generations of unassimilated Muslim immigrants, hasn’t been a happy one.

Inevitably, Merkel’s policy will act as an enormous magnet to refugees and migrants. If the alternative is living anywhere outside the advanced West, even in those places not riven by civil war, who wouldn’t choose the wealthy colossus of Northern Europe and it’s generous welfare system?

Germany has actually gotten more asylum-seekers from the Balkans than from Syria this year.

Germany’s approach will also affect the rest of Europe, especially countries that are transit points. It is supposed to be EU policy that asylum-seekers must apply in the country where they arrive. In keeping migrants from getting on trains to Germany and Austria — a public-relations fiasco — Hungary was merely trying to enforce this rule.

But if migrants know that, as a practical matter, Germany beckons if they get a foothold in Europe, the incentive to go is all the larger.

The beginning of a rational policy would be to discourage people from making the hideously trying and dangerous journey in the first place, and in this, learn from the Australian experience.

Australia’s geography, of course, is an advantage in enforcing its borders. It still had asylum-seekers arriving by sea. It adopted a policy with bipartisan support of “stopping the boats.”

Australia doesn’t allow people seeking asylum to remain in the country while their claims are considered; instead, they are sent to facilities overseas. The number of boats arriving went from 300 in 2013 to 0 a year later.

By the same token, Europe should insist that people applying for asylum do it from outside of Europe, from safe havens along the border or even inside Syria and from countries in the regions from which migrants are fleeing.

Certainly, Turkey, Jordan and Lebanon are doing their part. Turkey is host to nearly 2 million Syrian refugees. Lebanon, a country of 4.4 million, has 1.1 million. In Jordan, 20 percent of the population is refugees.

But the Gulf states have none, even though they are very rich and sparsely populated, in addition to being Arab and in the immediate vicinity.

European countries should be jawboning them to do more, and should be sending as much humanitarian and financial aid to care for the refugees as possible. It also would help if the West had an effective political and military strategy against ISIS in Syria.

None of this is easy or cheap, but, with all due respect to Angela Merkel, nor is providing a second home for the countless millions who want one.