In the 18th and 19th centuries, Europeans populated the world. Now the world is populating Europe.
Beyond the furore about the impact of the million-plus refugees who arrived in Germany last year lie big demographic trends. The current migration crisis is driven by wars in the Middle East. But there are also larger forces at play that will ensure immigration into Europe remains a vexed issue long after the war in Syria is over.
Europe is a wealthy, ageing continent whose population is stagnant. By contrast, the populations of Africa, the Middle East and South Asia are younger, poorer and rising fast.
At the height of the imperial age, in 1900, European countries represented about 25 per cent of the world's population.
Today, the European Union's roughly 500 million people account for about 7 per cent of the world's population. By contrast, there are now over a billion people in Africa and, according to the United Nations, there will be almost 2.5 billion by 2050.
The population of Egypt has doubled since 1975 to more than 80 million today. Nigeria's population in 1960 was 50 million. It is now more than 180 million and likely to be more than 400 million by 2050.
The migration of Africans, Arabs and Asians to Europe represents the reversal of a historic trend. In the colonial era, Europe practised a sort of demographic imperialism, with white Europeans emigrating to the four corners of the world.
In North America and Australasia, indigenous populations were subdued and often killed - and whole continents were turned into offshoots of Europe. European countries also established colonies all over the world and settled them with immigrants, while at the same time several millions were forcibly migrated from Africa to the New World as slaves.
When Europeans were populating the world, they often did so through "chain migration".
A family member would settle in a new country such as the US; news and money would be sent home and, soon, others would follow.
Now the chains go in the other direction: from Syria to Germany, from Morocco to the Netherlands, from Pakistan to Britain. But these days it is not a question of a letter home followed by a long sea voyage. In the era of Facebook and the smartphone, Europe feels close even if you are in Karachi or Lagos.
Countries such as Britain, France and the Netherlands have become much more multiracial in the past 40 years. Governments that promise to restrict immigration, such as the current British administration, have found it very hard to deliver on their promises.
The EU position is that, while refugees can apply for asylum in Europe, illegal "economic migrants" must return home. But this policy is unlikely to stem the population flows for several reasons.
First, the number of countries that are afflicted by war or state failure may actually increase; worries about the stability of Algeria are rising, for example.
Second, most of those who are deemed "economic migrants" never actually leave Europe. In Germany, only about 30 per cent of rejected asylum seekers leave the country voluntarily or are deported.
Third, once large immigrant populations are established, the right of "family reunion" will ensure a continued flow. So Europe is likely to remain an attractive and attainable destination for poor and ambitious people all over the world.
One possible reaction for Europe is to accept that migration from the rest of the world is inevitable - and embrace it wholeheartedly.
Europe's debt-ridden economies need an injection of youth and dynamism. Who will staff their old-age homes and building sites if not immigrants?
But even those Europeans who make the case for immigration tend to argue that newcomers to the continent must accept "European values". That may be unrealistic, partly because many of these values are of relatively recent vintage.
In recent decades, feminism has made great strides in Europe and attitudes towards gay rights have been transformed. Many immigrants from the Middle East and Africa bring much more conservative and sexist attitudes with them. It will take more than a few civics classes to change that.
Europeans are profoundly confused about how to respond to these new challenges. In the age of imperialism, they justified settling foreign lands with the confident belief that they were bringing the benefits of civilisation to more backward parts of the world.
But post-imperial, post-Holocaust Europe is much more wary of asserting the superiority of its culture. It has replaced a belief in its civilising mission and the Bible with a focus on universal values, individual rights and international treaties.
The big question in the coming decades is how Europe's faith in universal liberal values will withstand the impact of mass immigration. A battle between nativists and liberals is beginning to shape politics.
I expect the nativists to lose, not because their demands are unpopular but because they are unenforceable. It may be possible for island nations surrounded by the Pacific Ocean, such as Japan or Australia, to maintain strict immigration controls. It will be all but impossible for an EU that is part of a Eurasian land mass and is separated from Africa only by narrow stretches of the Mediterranean.