This essay is part of The Great Migration, a series by Lydia Polgreen exploring how people are moving around the world today.

We are living in an age of mass migration.

Millions of people from the poor world are trying to cross seas, forests, valleys and rivers, in search of safety, work and some kind of better future. About 281 million people now live outside the country in which they were born, a new peak of 3.6 percent of the global population according to the International Organization for Migration, and the number of people forced to leave their country because of conflict and disaster is at about 50 million — an all-time high. In the past decade alone, the number of refugees has tripled and the number of asylum seekers has more than quadrupled. Taken together, it is an extraordinary tide of human movement.

The surge of people trying to reach Europe, the United States, Britain, Canada and Australia has set off a broad panic, reshaping the political landscape. All across the rich world, citizens have concluded — with no small prompting by right-wing populists — that there is too much immigration. Migration has become the critical fault line of politics. Donald Trump owes his triumphant return to the White House in no small part to persuading Americans, whose country was built on migration, that migrants are now the prime source of its ills.

But these vituperative responses reveal a paradox at the heart of our era: The countries that malign migrants are, whether they recognize it or not, in quite serious need of new people. Country after country in the wealthy world is facing a top-heavy future, with millions of retirees and far too few workers to keep their economies and societies afloat. In the not-so-distant future, many countries will have too few people to sustain their current standard of living.

The right’s response to this problem is fantastical: expel the migrants and reproduce the natives. Any short-term economic pain, they contend, must be borne for the sake of safeguarding national identity in the face of the oncoming horde — a version of the racist “great replacement” theory that was once beyond the pale but has become commonplace. But we can see how this approach is playing out, in a laboratory favored by Trump and his ilk.

In Hungary, object of much right-wing admiration, the government of Viktor Orban’s twin obsessions are excluding migrants and raising the country’s anemic birthrate. But reality has proved to be stubborn. Hungary has made almost no progress on the latter, and on the former, the government has been courting guest workers in the face of a chronic labor crisis. That’s despite Orban having declared, in the teeth of the Syrian migrant crisis in 2016, that “Hungary does not need a single migrant for the economy to work or the population to sustain itself or for the country to have a future.”

Hungarians, especially young, skilled and ambitious ones, disagree — and are voting with their feet by themselves becoming migrants. Faced with a weak economy, 57 percent of young Hungarians said in a recent survey that they planned to seek work abroad in the next decade; just 6 percent said they definitely planned to stay in Hungary. One-third of those who leave the country have a college degree, another survey found, and nearly 80 percent are below 40 years old. The government has spent millions to try to lure young Hungarians back home, with little to show so far. Demographers say that the population could drop to 8.5 million by 2050, a loss of about a million people.

Orban’s Hungary should be a cautionary tale for other nations, not a model. But its trajectory tells us a lot. Change is always hard, and the more rapid and unexpected the change, the more difficult it is to accept. We are lousy at predicting how many humans there should be and where they should live; the timing and geography of demographic shifts is often off-kilter to human needs. Migration messily brings both difficulties to the fore, offering both a challenge and an opportunity. It also eludes easy fixes and lazy characterizations.

Yet despite migration’s centrality to our politics and our world, nobody really understands it.

Political debate about migration today appears to be dominated by a set of assumptions: that migration will be from the global south to the global north; that the richer countries will always control the terms on which that happens; and that rich countries will always be able to pick and choose among the most talented people and turn away the rest.

But what if it doesn’t work out that way? There are plenty of reasons to believe that over time these assumptions will founder in the face of a vast reordering of the map of opportunity across the globe, set in motion by the political ferment and economic torpor besetting wealthy democracies.

Already we see the young people of many European countries leaving their homelands in search of opportunity — many to other wealthy countries in the West but also to the rapidly growing economies in the Gulf states and Asia. As European economies struggle to grow and more people leave the work force, these trends are likely to accelerate. Trump, now the leader of the world’s most sought-after migrant destination, has proposed policies that could lead the United States down a similar path.

What leaders and policymakers in the rich world don’t seem to grasp is that the roster of countries that will need more people is growing fast, as birthrates plummet much faster than anyone expected in countries that have long been a source of migrants. Our politics revolve around the idea that scarce resources mean keeping people out. We are utterly unprepared for a world in which perhaps the scarcest resource will be people.

“In this hyperpolarized environment and debate, many people have missed the big picture,” said Marco Tabellini, an economist who studies migration and political change at Harvard University. “Countries in the global north will have to really compete for migrants.”

If you think that sounds preposterous, it is worth considering that this competition is already happening and has been for some time. After the toppling of the cruel Syrian dictator Bashar al-Assad, governments across Europe wasted no time announcing that they would pause asylum applications from Syrians, clearly eager to see the back of the Syrians who fled the country’s gruesome civil war. But in Germany, health officials fretted that amid a broad shortage of medical workers, losing thousands of Syrian doctors would be a heavy blow to the country’s already overmatched health system.

But it is not just doctors whom countries in the rich world lack. Canada, amid an excruciating housing shortage, needs skilled construction workers. Italy needs welders and pastry cooks. Sweden needs plumbers and forestry workers. As for the United States, it is hard to imagine how profoundly people’s lives will change as Trump attempts to carry out his promised mass deportation program. What Americans eat, how they care for their children and elders, how many homes get built — all will be transformed with powerful effects not just for the economy but also for how people organize their lives, on where they set their sights and ambitions.

The right has no real answer to this problem and continues to argue for harsher restrictions. Centrists the world over have broadly capitulated to the right’s framework, turning away from the postwar commitments to asylum and promoting technocratic solutions like skilled migration, arguing that the rich world will be able to sluice through the rivers of humanity, discarding the pebbles and selecting the nubs of gold.

But they do so at their peril. Restrictive policies, once imposed, tend to last a very long time and have far-reaching, unforeseen consequences. People turned away from one country or offered a place on unattractive terms in an unwelcoming environment will find a way to build lives elsewhere, bringing their ideas, talents and drive to other places. That’s because of a powerful and often ignored force: the agency of migrants.

The pull of remaining in the place of your birth is one of the most powerful and enduring human impulses. It is easy to forget that even in this age of mass movement of people, where vast distances can be crossed more quickly than ever before, more than 96 percent of the world’s people live in the countries in which they were born. Most who flee disaster don’t go very far, traveling to relative safety within their own country or one next door, hoping to return home as soon as the catastrophe has passed.

Migration to another country, especially one a fair distance away, isn’t undertaken by people who are truly destitute or who lack ambition. It requires resources, documents, connections. Having the will to leave, to seek out something new and leave everything and everyone you know behind, is a profound act of self-creation.

The panic about migration, it strikes me, is really a panic about the future — and about progress. Migrants are individuals making a profound, risky bet that by undertaking the rare and difficult decision to leave home, they can build something new. Behind opposition to migration is often the reverse: a belief that the only way to protect the future is to make it more like the mythic past, to build something old. But this approach, as we will see, has never been a formula for human flourishing.

At the end of World War II, the victorious powers in Europe decided that ensuring peace on the continent required moving large numbers of people into more broadly homogeneous states. One of the biggest and most pressing orders of business was to uproot millions of ethnic Germans who had long lived in Poland, Czechoslovakia, Romania and beyond and force them to move within Germany’s new border.

This was a pitiless, brutal process. Writing in this newspaper in 1946, the journalist Anne O’Hare McCormick described her reaction to witnessing the forced resettlement of Germans: “No one seeing its horrors firsthand can doubt that it is a crime against humanity for which history will exact a terrible retribution.” This quote appears early in Tony Judt’s masterwork, “Postwar,” and Judt delivers a typically pitiless assessment of it: “History has exacted no such retribution.”

These events are largely forgotten today. But this period of score-settling remade the demographic map. Many Ukrainians wanted to be rid of Poles, and many Poles wanted to be rid of Ukrainians. Hungarians were expelled from Czech territory. Astonishingly, 4,000 Jews in Central and Eastern Europe were among those forced from their homes as part of this postwar upheaval.

At the time, all the uprooting seemed to make a certain kind of sense. At the end of the war, even though so many had died, there was a concern that Europe had too many of the wrong people living in the wrong places and that this was part of the problem that led to war. When closing some of the last of the lingering camps for those displaced by the war, one top official called those forced to flee “an excess of people in Europe whose very presence constitutes a threat to political and economic stability.”

And yet almost immediately, the vision of largely homogeneous states ran up against the reality that the relatively free movement of people would be required to rebuild the shattered countries in the aftermath of the war. Amid the sudden prosperity of the postwar economic boom, a great voluntary uprooting began, sending Europeans across borders in search of work. Countries also looked farther afield — Germany to Turkey, France and Britain to their former colonies in Africa and Asia and so on. Indeed, over time the benefits of diversity and ease of movement of people and goods led to the creation of the European Union.

“It is often said by opponents of migration that ‘Europe is full,’ as if a continent or a country is a fragile vessel at risk of capsizing under the weight of migrants,” the British historian Peter Gatrell wrote in his magisterial history of this migration, “The Unsettling of Europe.” “The metaphor is a powerful one. But it can be turned on its head. Migrants have made all kinds of contributions to Europe. Indeed, they helped to build the boat.”

For the United States, founded by European settlers on the premise that outsiders were essential to the nation’s prosperity, the problem for much of its early history was a scarcity of people. Its settlers acquired vast stretches of land through genocide and ethnic cleansing of Indigenous inhabitants, then populated and worked that land with migrants, indentured servants and enslaved people. For a century, almost any free person who could manage to reach the United States could stay there.

But gradually attitudes turned against migration. Some of the earliest federal policies of restriction targeted Chinese immigrants, beginning in the 1880s, and the 1924 Immigration Act was designed to discourage unskilled workers from countries in Southern and Eastern Europe and bar almost all immigrants from Asia. These laws were driven by racist ideas in vogue at the time, notions that suggested only white, Protestant Europeans and their descendants represented true American identity and that other groups, such as Catholics and Jews, could not be counted on to integrate and contribute to American society.

In recent years, scholars have used data from that era of restriction to try to understand how these laws affected American prosperity. One Harvard study found that Chinese exclusion depressed economic growth in the western United States, where a vast majority of Chinese immigrants lived, and had negative consequences for most workers. The effects lasted until just before the United States’ entry into World War II.

Another piece of research demonstrated how strict quotas on immigrants from Southern and Eastern Europe hampered American innovation — characterized by a significant drop in the number of patents issued to American scientists in certain fields. What is most striking about this study is that the quotas on Southern and Eastern Europeans did not apply to students and professors. But the quotas had a strong effect on dissuading academic scientists from these regions anyway, one of the paper’s authors, Petra Moser, a professor at New York University, told me.

“If I face a country that doesn’t want other people of my nationality, I may just not want to come,” she said. Her paper describes the loss to American science during this period as “equivalent to eliminating the entire physics department of a major university each year between 1925 and 1955.”

These findings are especially poignant when you think about who was excluded. The United States maintained its strict quota system despite the desperate plight of European Jews trying to flee the Nazis. Astonishingly few German Jews managed to get visas to emigrate under the quota system. Eastern European Jews, citizens of countries explicitly discouraged under the law, had almost no chance at all. Millions of them would perish in the Holocaust.

These horrors led directly to the creation of international laws governing the rights of refugees and the responsibility to provide asylum to those in need of safety. It is also part of the reason so many Syrian refugees are in Germany today. In 2015, when Europe faced record-high numbers of asylum seekers, most of them from Syria, Afghanistan and Iraq, Germany’s chancellor, Angela Merkel, made her famous declaration: “We can manage.”

In retrospect, it is hard not to see that moment as a hinge of history. Almost immediately, public opinion turned against Merkel, and right-wing, anti-immigrant politics surged across Europe. Less than a year later, Britain voted to leave the European Union, with many leave voters citing immigration as their top concern. And not long after that, Trump rode fears about migrants massing at the southern border to the presidency, promising to build a wall and bar Muslims from entering the country. Across the developed world, far-right parties gained support and started taking power.

This anti-migration rightward march has continued. A decade after Merkel’s stirring pro-refugee declaration, the far-right Alternative for Germany party is consistently polling in second place, with a fifth of the vote, going into elections in February. The global consensus that we have an obligation to protect the most vulnerable has all but collapsed, like so many other pillars undergirding the world order since World War II.

I have come to wonder if the political response to anti-migrant sentiment — the steady erosion of principles of free movement and refuge that were the bedrock of the postwar era — might in time look like a terrible failure of imagination on a civilization-altering scale. Governments shut themselves off from migrants at their peril.

There’s also no guarantee it will actually work. Harsh attempts to control the size and movement of a population often have unanticipated consequences. Just look, for an inexact but apt analogy, to China’s one-child policy. Nearly five decades ago the edict that most couples should have only one child might have seemed a necessary step for dragging China out of poverty, even if it required brutal enforcement in the face of a strong preference for larger families.

But it seems that even Maoist revolutionaries struggled to imagine how quickly the world can change. Perhaps China’s leaders thought this policy would be required indefinitely and assured themselves that if the spigot needed to be reopened, the assumedly natural impulse to have more children would hardly require encouragement. Having bent human will before, why would they not believe they could do it again?

It has not worked out that way, and underpopulation is now a major challenge for China’s prospects. In the mid-2010s, China had roughly seven workers for every retiree. In 2050 there may be only two. It will almost certainly be among the nations competing with the West for migrants in the decades ahead.

Throughout history, generally speaking, migration tends to produce two seemingly contradictory results: sharp but short-term backlash among those who already live in the migrants’ destination, followed in the medium to long term by greater abundance and prosperity. Whatever nightmare pressed people to leave home — war, famine, natural disaster — their arrival unleashes torrents of human dynamism. The movement of people, even or especially under duress, is inextricably tied with human progress.

Partly, that’s economic. The relationship between human talent and economic growth is extremely clear, and history is replete with examples of liberal migration policies leading to broad prosperity. As we’ve seen, periods of strict immigration restriction have often had surprising and, in retrospect, unwanted results: less innovation and more stagnation.

But I would argue that economic growth is actually downstream from something more important yet intangible: the human desire for flourishing and to set one’s own path in life. People have moved for many reasons, but always because they sought something they wanted that they could not get at home. It’s an act of faith, fundamentally, kindled by the fire of human aspiration. It can never fully be snuffed out.

In our vastly more interconnected world, hard borders and iron-fisted control is a fantasy. Migration has always involved great sacrifice, especially for those who leave home. But it also requires the people in the places migrants alight to see beyond the immediate shock of living alongside new people from different places and conceive the long-term possibilities such arrivals always bring.

Right now, with Trump seizing the levers of power in Washington and promising to send migrants to Guantánamo Bay, that might seem extremely unlikely. But the long history of migration, and its unknowable future, suggests the wisdom in trying. In any case, the West may not like migrants — but like aging German patients in search of the healing hand of a doctor, it is sure to miss them when they are gone.