How to explain the inexplicable Hungarians? Why have so many of them backed Prime Minister Viktor Orbán’s decision to ward off migrants and refugees by installing barbed-wire entanglements on the country’s borders with Serbia and Croatia? As a signatory to the United Nations’ 1967 Protocol Relating to the Status of Refugees, Hungary is obliged to offer them protection. Yet 66 percent of Hungarians say that refugees present a danger to Hungary, and only 19 percent believe they have a duty to take in people who are fleeing from danger themselves.

Just a generation ago, nothing captured the spirit of 1989 better than Hungarian border guards applying wire cutters to the fences separating their country from Austria. That summer, thousands of East Germans rushed to Hungary hoping to escape communism, causing a panic back home that led to demonstrations and the opening of the Berlin Wall in November. Their migration was a counterpoint to an earlier one in 1956, when an estimated 200,000 people escaped Moscow’s suppression of the Hungarian Revolution by fleeing across an open border to Austria, and then on to dozens of countries willing to take them in as new citizens.

Not so long ago, Eastern Europe’s civil-society movements demanded that all people be able to travel freely; open borders were considered a human right. Yet today, Hungary has been joined by Poland, Croatia, Serbia, Macedonia, Slovakia, and the Czech Republic in an effort to bar Muslim migrants from crossing into the European Union, even though refugees from these countries were welcomed in Western Europe during the Cold War and after. The arguments defending Hungary’s new barbed-wire barriers hark back to a time before the concept of human rights was enshrined. Orbán has tapped into a consensus throughout Central and Eastern Europe that Muslim migrants from Syria and Iraq cannot integrate because they are not Christian. And if anyone needs proof, the argument goes, then just consider what refugee mobs did to women in Cologne on New Year’s Eve. Countries in Western Europe are also putting up barriers, but the exclusiveness, while cruel, isn’t total. France feels overburdened, but it has not said that it will accept no refugees at all. (In May, Paris Mayor Anne Hidalgo announced plans to build a refugee camp in the capital city.) The same is true of the Scandinavian nations.

The notable exception is Germany, where Chancellor Angela Merkel has insisted there will be no limit set on how many refugees the country will absorb. Germany is much wealthier than its neighbors, but it’s still a relatively small and densely settled place, about 17 percent smaller than California but with twice the population (80 million). Yet last year, it took in over a million migrants, chiefly from Syria, Afghanistan, and Iraq. According to a report leaked in February, the country will absorb some 3.6 million non-Europeans by 2020, by the German government’s reckoning.

Leading politicians in her own coalition have accused Merkel of dividing Germany, but she has held her course with support from the center and the left, especially the Green Party. In February, one Green-governed state rejected the federal government’s demand that economic refugees be returned to Afghanistan, arguing that there was no airport in that country where it was safe to land. Despite pervasive doubts about how Germany will someday assimilate the hundreds of thousands of newcomers, 90 percent of Germans say that their country should continue to offer refuge to people fleeing terror and war.

* * *

For all of it resonances, the Cold War isn’t the most helpful precedent for understanding the paradoxical attitudes in Europe today toward migrants and refugees. A better one is the migration crisis that shook the continent in the decades just before World War I, when instead of clamoring to get into Europe, migrants were desperate to get out. As the University of Chicago professor and Mac- Arthur fellow Tara Zahra explains in her superb book The Great Departure, between 1846 and 1940 as many as 58 million people left Europe for North and South America, with most of them abandoning the Eastern European countries that have recently turned against accepting migrants.

In fin-de-siècle Vienna, newspapers featured regular reports sounding alarms about the mass exodus, but the causes resisted easy explanation. Matters came to a head in 1890, when agents at the Oswiecim rail hub in what is now southern Poland were put on trial for fraud. Oswiecim was the final stop in the empire before migrants changed trains for the German Empire and points west. Austrian officials alleged that gangs of profiteers were descending on unsuspecting peasants at the train station and diverting them to travel offices that were supposedly run by the government, complete with portraits of the Emperor Franz Josef hanging on the walls. Here the agents, clad in imperial uniforms, requisitioned passports and billfolds in return for documents of passage, leaving the travelers nearly penniless. Next door was a tailor who outfitted men in the type of suit supposedly required for entry into the United States. Nowadays, we tend to refer to Oswiecim by its German name: Auschwitz. As it happened, the five travel agents put on trial were Jewish. They were all found guilty and sentenced to three to four years in prison.

Politicians in the Austrian Empire didn’t care equally about population loss. Because of the primitive farming methods used in the empire’s eastern provinces, arable land there couldn’t support the population. Commentators from the western provinces where German or Italian was spoken viewed the migrants as surplus population and argued that their departure would contribute to social peace by relieving the misery on small farms. But the intellectual elites from those eastern lands were anything but sanguine. In 1893, the Czech agronomist Vilem Tekly bemoaned the state’s failure to stop his fellow countrymen and -women from abandoning their farms by the thousands. No one in Vienna seemed even to know how many were leaving. The “statistical central commission,” Tekly claimed, released “its publications at a snail’s pace and only in German, as if the other nationalities did not exist.” The only solution was to make the Czech lands self-governing, similar to Hungary, which the Habsburgs had accorded de facto independence within the Austrian Empire in 1867.

The monarchy’s compromise on Hungary betrayed its weakness. Originally a family from southern Germany, the Habsburgs had conquered or inherited vast territories in Central and Eastern Europe over many centuries. Yet by 1867, the arch-conservative dynasty was lagging behind dynamic economic and military powers like Britain and France; and in order to manage its huge war debts, it cut a deal with the strongest and most troublesome of the empire’s subject nations. From that point, the realm was divided: the east under the control of elites in Budapest, and the western territories—soon called simply “Austria”—ruled by a more diverse government in Vienna.

The populations and politics of the resulting Austria-Hungary were enormously complex. Hungary comprised today’s Hungary and Slovakia, but also parts of Croatia, Serbia, Romania, and Ukraine, while Austria included the Austria, Slovenia, and Czech Republic (also known as Bohemia) of our day, but also southern Poland and parts of Croatia, Italy, and Ukraine. The halves were united in the person of the emperor and by a common defense and foreign policy, but they were governed very differently. In return for their cooperation, Hungary’s elites were allowed to treat their lands as a political nation, single and indivisible, and to do whatever was necessary to make the many ethnicities within their realm into Hungarians. Tekly wanted the Czechs to do likewise in his native Bohemia. But the leadership in Vienna, old-school and culturally German, was agnostic on the question of nationality, promising equality to all the various “national tribes” of the empire’s Austrian lands.

If there was anyone more anxious than Tekly about Austria’s population loss, it was Leopold Caro, a Polish economist descended from a Sephardic rabbinical family who converted to Catholicism as a young man. Beginning in the 1890s, Caro fretted over the fate of the Polish people, who like the Czechs had no state, but unlike them were scattered across three empires: Austria-Hungary, Russia, and Germany. That had been the case since 1795, when these states not only wiped the Kingdom of Poland from the map but also determined to “abolish everything which could revive the memory” of its existence. In 1908, Caro published a book describing the challenges of maintaining Poland without a formal state. Just a few decades earlier, he explained, it was widely accepted that Poles living under Russian or German rule would speak their own language and create their own culture. But more recently, German and Russian authorities had demanded that the Poles “dissolve in the vast sea of German and Russian statehood.” In response, Caro noted, an ethno-nationalist reaction had arisen among Poles insisting that the “entire people be Polish.” Poles managed to maintain their identity despite the suppression of Polish schools in Russia and Germany, even if it meant conducting clandestine classes in Polish language and literature.

For Caro, everything had to be done to prevent Polish peasants from leaving Austrian Galicia. (Like Tekly, he expected his people would have their own state, probably under Habsburg rule.) Caro was equally worried about the Poles being threatened by another nation living within their own—the Jews. The Jews were dangerous, he claimed: Besides running travel agencies, they sold supplies and liquor and lent money to naive peasants at exorbitant rates, causing them to go bankrupt and try to emigrate. Caro demanded that moneylenders be banned from the countryside and that the state guarantee Polish peasants credit at fair prices. These policies, he asserted, would encourage Jews to seek “more honest” trades involving the kind of manual labor that they supposedly despised.

* * *

Caro’s writing epitomizes the strain of racist ethnocentrism that took hold of popular opinion throughout East and East Central Europe in the late 19th century. Yet national identity was understood quite differently only a generation earlier: Caro’s father Henryk had fought in the 1863 Polish uprising against the czar and was the first Jew buried in Krakow with Polish orthography on his gravestone. At that time, it wasn’t unusual for Jews to be celebrated as Polish patriots. But when Leopold Caro came of age in the late 1880s, the pressures of ethnic exclusivism—fed by concerns for the survival of a people newly defined in racial terms—made it seem impossible for a Jewish-Polish patriot to also be a Polish nationalist.

Although they may have been otherwise nonchalant about the emigration of Slavic populations, Viennese bureaucrats did care deeply about its impact on the military draft. The government certainly had the tools to rectify it: In the 1867 Constitution, men eligible for military service at age 21 were the one exception to the general principle of freedom of emigration, or Freizügigkeit. Yet in 1913, as Zahra notes, an estimated 120,000 recruits were missing from the annual call-up, 80,000 in Galicia alone. That same year—23 years after the Oswiecim trial—Austria’s minister of war exclaimed: “From the military point of view the best thing would be to close all of the travel agencies.” Yet the work of the profiteers continued unimpeded.

What was Austria’s problem? Why couldn’t an empire hold on to its citizens—or at least register those who were leaving? Zahra looks for answers by following the migrants across the Atlantic to the New World, beyond the gates of Ellis Island and into the overcrowded, fetid neighborhoods of New York City. For many Austrian migrants, their first night’s shelter was a boardinghouse on Greenwich Street subsidized by the Austrian government. But the facilities were not welcoming. A New York City Health Department report from 1903 described “old and dilapidated” buildings, leaky roofs, damp walls and ceilings, and filthy bathrooms. “Women slept in an unventilated attic with 13 beds.” Evidently this state of affairs did not perturb the Austrian consular officials or their superiors in Vienna. A new home was established on East 80th Street in 1907, but the following year it too was cited for violations, and after another year its representatives were barred from welcoming immigrants at Ellis Island.

Yet there were organizations in New York that were solicitous toward the newcomers. As Zahra explains, “self-identified Polish, Slovak, Czech, or Hungarian associations, homes, and cooperative societies increasingly offered assistance and community to migrants.” It turns out that Tekly was right: It took organizations founded by ethnics to care for fellow ethnics. But why did these associations care about people who had abandoned the homeland? Because, in their eyes, they hadn’t abandoned it. These immigrants may have left their farms, but they still embodied the larger Polish and Czech nations; they were an extended arm of their strength, adding to the national welfare through remittances, but primarily through the physical example of themselves—and their children—as Poles or Czechs or Slovaks. To this day, the governments of Poland and Hungary support educational and cultural activities directed at people of Polish and Hungarian descent living abroad. Their work differs from that of the Goethe Institut or the Alliance Française, which support cultural activities like language courses in other countries but not the physical ethnic presence of the German or French nation abroad.

Austria’s neglect of its citizens in New York City reflected and reinforced the indifference toward emigration in Vienna. Ultimately, multinational Austria was a structure sustaining a dynastic family that did not discriminate against any of its peoples, but that did not discriminate in their favor either—facts that explain why the empire seemed dysfunctional to its ethnic nationalists, but has looked better to every generation since. Indeed, the extremist descendants of those nationalists have committed crimes, such as ethnic cleansing and genocide, that were barely conceivable in 1910. Had Caro not died of old age in 1939, the Nazis would have identified him as Jewish instead of Catholic.

The Great Departure is the final volume in Zahra’s trilogy about how national movements in East Central Europe in the 19th and 20th centuries desperately tried to awaken often indifferent peoples to a sense of national identity. (The previous volumes are Kidnapped Souls and The Lost Children.) Zahra explains in Kidnapped Souls that in the early 20th century, bilingual inhabitants of the Czech lands seemed especially impervious to nationalist stirrings, often refusing to tell census takers whether they were German or Czech. And why should they have done otherwise? Speaking German or Czech with equal fluency, thousands leveraged their complex identities to maximum effect, depending on whether a situation rewarded a German persona or a Czech one, or simply indifference. Zahra is a touch nostalgic about the Bohemia of this period, when bilingualism and a fluid sense of identity were sheltered by a non-nationalist state. Yet did such indifference, and its accidental benevolence, ever stand a chance against the pressures of nationalism, the most potent ideology of the past millennium?

We will never know, because World War I settled the matter. Woodrow Wilson’s call for what came to be known as national self-­determination, issued while the war was still raging, strengthened the impetus for the emergence of nation-states from the ruins of the Habsburg, Ottoman, Romanov, and German empires. Unfortunately, Wilson was ignorant of the ethnic complexity of Eastern Europe, as well as the radically different understanding of “nation” prevalent there. When he promised Eastern Europeans self-determination, he mistook their regions for bounded countries like the United States or France, and thought their nations defined by a common citizenship. In fact, in Hungary, Galicia, or Bohemia, various ethnic groups lived inseparably mixed, claiming the same towns and villages as their own. For example, Germans and Czechs were equally at home in Prague; the same was true of Ukrainians and Poles in Lviv. And when Central and Eastern European nationalists spoke of the nation, they meant the ethnic group, a tribe that a person could only be born into and that spoke a common language. In Western Europe and the United States, by contrast, nations were political communities that governed a given territory.

For those people who might have been indifferent, the governments of the new states created after World War I—Poland, Czechoslovakia, Yugoslavia, Romania—inculcated national identities through public education and founded colonial societies to keep those who emigrated firmly in the nation’s orbit. On the other hand, no one minded when non-nationals left. While maintaining a commitment to the free movement of people, for example, Yugoslavia’s government made it more difficult for Yugoslavs (Serbs, Croats, Slovenes) to leave than ethnic Hungarians. Poland was delighted to bid adieu to ethnic Germans while endeavoring to Polonize hundreds of thousands of Ukrainians in its eastern territories.

None of these new nation-states embraced the Jews living within their borders: Nowhere were they made to feel they belonged, and everywhere the dominant ethnicity hoped they would leave. Zahra reminds us of the desperate attempts to escape that many Jews made, often encouraged by local regimes. Poland explored sending Jews to Madagascar, while Romania made 270,000 of its Jews stateless. The ultra-nationalist Czechoslovak Second Republic (1938–39) set up an Institute for Refugee Welfare to encourage the emigration of Jews, whose property would then be transferred to the Czechs expelled from the Sudetenland—an area of Czechoslovakia that the Western Allies had granted to Nazi Germany. These are notoriously difficult matters to sort through, but Zahra makes a remarkably deft nonjudgmental judgment: “Was the institute a humanitarian organization to be credited with rescuing Jews? Or was it a collaborationist organization that facilitated the expropriation and deportation of Jews from Czechoslovakia?” Arguably, she writes, it was both: “In the end, there was a very thin line between the rescue, deportation, and expropriation of Czechoslovakia’s Jewish population, just as there was an ambiguous frontier between rescue and removal at the international level.”

* * *

Eastern European countries are attempting to deter immigration today for the same reason they tried to halt emigration a century ago: to protect themselves as ethnic nations whose existence has been threatened over the centuries, first by imperial powers like Austria, Russia, and Ottoman Turkey; then by Nazi Germany and the Soviet Union; and recently, for some, by the European Union. Such sensitivity to foreign domination may not be unusual, but the ethnic nationalism behind it is.

Its origins lie in the national revolutions that swept through different parts of Europe many generations ago. In Western Europe, the nation constituted itself by opposing the native monarch. When the French Revolution unseated the French king, legitimacy, or the right to rule, was transferred from him (and the divine) to the people—the nation. Questions of culture and language were secondary, because in the 1790s there was no dilemma as to what France was or whether the French people had a right to French territory. Primary was the idea that all Frenchmen were citizens with equal rights.

In Central and Eastern Europe, by contrast, nationalists agitated against the foreign power occupying their territory. Czechs pitted themselves against the Austrian Habsburgs, Romanians against the Turks, and Poles against the Russians. But by what right did Czechs claim that the Kingdom of Bohemia was theirs? Until the 1860s, European maps showed Bohemia as part of Germany, smack between Berlin and Vienna. The only basis for Czech nationalism was a shared ethnic identity, reflected most evidently in language. Czech nationalists argued that Czech speakers had arrived in Bohemia centuries before the Germans, and therefore had a right to the land as its original owners. Similarly, Romanians claimed that they were descended from Roman colonists, thus long predating the Turks, Russians, and Magyars. These stirrings of original tribal ownership and unity were even felt in what would later become the German Empire under Bismarck. In the early years of the 19th century, Germans inhabited numerous tiny states like Hesse, Hanover, and Prussia, and they felt deeply humiliated by the presence of French troops occupying their lands, first during the Revolution and later under Napoleon.

Throughout Central and Eastern Europe, nationalists based their views on the work of German philosophers, above all Johann Gottfried von Herder (1744–1803), who taught that nations were indeed ethnic, united in holy language and culture. Even nations lacking a state had a mission before God and history. (In German, the bond between the people and the nation is so close that the two share the same noun: Volk.) After Napoleon was defeated in 1815, the German national movement continued to expand. In these same years, Eastern Europeans studying at German universities absorbed Herder’s ideas. They may have lived as stateless subjects of the Ottoman or Habsburg empire, but Herder taught them that they were a great people poised to realize their historical destiny. Eastern European national movements thus emerged alongside their German counterpart and racked up some small successes in the ensuing decades—right up to the big bang of 1918, when the Allies lifted them into ownership of their own states.

Such ideas sparked Caro’s notion that Poland was an indivisible nation in which each member owed a duty to the whole. The Polish people shared a past but had no known origin, because the ethnic nation was like an extended family, with one generation passing on its identity to the next. Such notions persist to our own day, and explain why Eastern Europeans cannot imagine Middle Eastern refugees being fully integrated into their own nations. How can members of a different tribe settle on “our” land as if they suddenly belonged to our tribe?

Yet Germany, the country where these ideas first took shape, is now accepting large numbers of Afghans, Syrians, and others. The sociologist Harald Welzer explains the mental adjustment on the part of Germans that Merkel’s Willkommenskultur requires: “No American would say that someone who immigrated from Anatolia was not American. In Germany, a country that has refused to think of itself as a land of immigration, even that person’s granddaughter would be counted as a person with ‘migration history,’” or Migrationshintergrund.

If Germany is breaking with a long national history, it’s because of Auschwitz and everything it evokes; if Eastern European countries are abiding by a dominant strain of nationalism, it’s because of the Oswiecim trial and everything it evoked. In both cases, the issue is genocide—in the first case physical, in the second cultural. For Germany, the future carries special obligations to ethnic others because a German state once tried to destroy them; for Eastern Europeans, the future involves vigilance against ethnic others to make sure their states do not face destruction in whole or in part. Paradoxically, it was the fear of destruction that impelled some of these nations to want to join the European Union after the implosion of the Soviet Empire.

* * *

Zahra refers to the West as the “free world,” and her book captures well the ambivalent freedoms it has offered to migrants. Even 19th-century American commentators who celebrated immigrants for invigorating the body politic favored certain “races” over others, and the enthusiasm for sharing American freedom with non-Americans waned in the 1920s, when immigrant laborers were seen as endangering rather than enhancing prosperity.

Zahra also describes the ambivalence of Austrian immigrants who arrived in the “free world,” only to return home. Many came to prefer a semi-incompetent Austria that offered basic health care, accident insurance, and old-age pensions to a life in the United States toiling away amid social insecurity. Perhaps the travel agents were innocent of false advertising, but the same could not be said for America’s image makers.

The gulf between the United States’ rhetoric and the freedom it was willing to share only grew in the years after World War II. On December 23, 1981, President Reagan encouraged Americans to place lighted candles in their windows to show solidarity with the Polish people. But in the years that followed, Zahra reminds us, Reagan’s government refused to recognize the status of the tens of thousands of Poles who had been stranded in the United States since the Polish government declared martial law on December 13, 1981. Reagan’s intransigence left them in limbo—or, more accurately, in a kind of purgatory. Zahra’s trenchant analysis calls to mind a discussion I once had with an East German academic behind the Berlin Wall in the 1980s. He noted that the United States was erecting barriers on its southern border; he made this point not as an argument in defense of walls, but as a relevant factor to consider when contemplating the one dividing Germany. I and the other Westerners scoffed: The barriers in Texas were being built to keep people from entering, not leaving. But he was right: One cannot complain about a country’s refusal to let people out if one’s own nation refuses to let them in.

The Cold War ended with the “free world” victorious but not satiated. In 2001, the United States launched Operation Enduring Freedom and created the instability that is a direct cause of the refugee crisis in Europe today. But while the United States has the greatest capacity to accept refugees, it is doing next to nothing to help. As the German journalist Bernd Ulrich wrote in Die Zeit in December, “The Americans are behaving more hysterically about the refugees that they will not take than the Germans are about the refugees they are taking.” The rhetoric in Germany is about dignity and not freedom: “Every human has a dignity given to him by God,” Merkel proclaimed at a conference of her Christian Democratic Union party last December.

To call Merkel and the CDU conservative, as American newspapers often do, is deeply misleading. Far from our own know-­nothing, antistate, anti-immigrant Republicans, Merkel is a progressive, and more: She is a revolutionary who wants to shatter the ethnically exclusive idea of national belonging that took root among Germans many generations before Auschwitz. Border controls, she tells her citizens, will throw Europe back to a time of “nation-statism,” or Nationalstaaterei. For Merkel, what many thought was the only solution to Europe’s last great migrant crisis a century ago is the wrong solution for today’s crisis. Her revolution will require massive investment and an even stronger state with thousands of additional bureaucrats, including language teachers, therapists, work counselors, and above all police officers. Will Germany be able to integrate over 1 million migrants? We may not know the answer for at least 20 years.

With a genius for the dialectics of real­politik that her fellow Prussians Bismarck and Karl Marx might have respected, Merkel eulogizes the ideals of the EU but worries above all about satisfying the German electorate and maintaining power. She will not lead Europe back to petty Nationalstaaterei, but the constituencies of her own nation-state are never far from her mind. That’s been especially true after the drubbing her party suffered in the local elections on March 13. In Baden-­Württemberg, a Christian Demo­cratic stronghold since 1946, the party slid from 39 to 27 percent, placing it behind the Greens in the region, while the anti-immigrant Alternative for Germany (AfD) jumped from 0 to 15 percent. In the formerly East German Saxony-Anhalt, the AfD scored 25 percent, becoming the region’s second-strongest party.

Germany has not closed its borders, but then it hasn’t needed to. Merkel criticized Austria for putting up barbed-wire fences along its border with Slovenia in late February, but because of those fences, the number of refugees entering Germany has become a trickle, falling from more than 1,000 a day to around 200.

In a move that some observers have compared to the reconstitution of the Habsburg Empire, Austria arranged a joint policy with the Balkan states to plug the “Balkan route” into Europe. Today, refugees gather at the northern Greek borders with Macedonia, facing barbed wire meant to keep them from the path to Germany. For the time being, their numbers are limited. Under German pressure, the EU has leaned on Turkey to stop the refugee flows to the Greek Aegean islands, as well as to take back any refugees who nonetheless make it there safely. The EU provides cash to host the refugees in Turkish camps, and to help process those from Syria who might qualify for asylum; it has also agreed to open talks on Turkey’s delayed application to become a member of the European Union.

This relief, if not Turkey’s EU application, is sure to be temporary. Karl Kopp of the refugee organization Pro Asyl says there is so much war and misery across the regions that border the Aegean and Mediterranean that people seeking shelter will come any way they can. The only thing Europe can decide is whether they arrive on its shores alive or dead. Reports indicate that at least 2 million people—and possibly as many as 6 million—are on their way, and if the Balkan route remains closed, they will come by way of North Africa, and then through either Italy or Spain. Austria is already fortifying its border with Italy.

There are reasons for hope, but also reasons for despair. Angela Merkel preaches that the European Union is a wealthy area of 500 million people that can easily share the burden of refugees. Thus far, however, member states haven’t succeeded in redistributing more than 1,500 refugees, and every new terror attack inflames the xenophobes. History provides no clear lessons, but it does issue a warning. The refugee crisis that Zahra discusses could not be resolved by managing the migration of peoples, because in the 1920s international borders were sealed. But solutions were eventually found, along with a new vocabulary for them: “genocide,” “the Holocaust,” “ethnic cleansing.” Organizations pledged to protect human rights were also established, but as we have seen in recent months, UN conventions that lack international cooperation are dead letters. In Europe, only Germany has learned the lessons of the past century.