I first met Viktor Orban, the not-quite-dictator of Hungary, in 1989 in Budapest, and the man who introduced us was none other than George Soros.
Orban was then a firebrand student leader, anti-Communist and keen for Hungary to join the West. Soros, a Hungarian refugee who became an American billionaire, was devoting his time and money to finding and subsidising young Eastern Europeans who would lead their countries into the European Union and a liberal democratic future.
But Orban is now Prime Minister of an "illiberal" Hungarian Government that controls the mass media and regards the EU as the enemy.
In last April's election, he portrayed Soros as the Jewish evil genius who, with the EU's help, planned to flood Hungary with Muslim refugees and destroy its culture and identity.
Ridiculous, but Orban won almost half the votes and more than two-thirds of the seats in Parliament. Poland, a far bigger country, now also has a far-right, "illiberal" government that is ultra-nationalist and hostile to the EU (although both countries depend heavily on EU subsidies).
The extremists are not yet in power in other Eastern European countries but similar trends are visible in the Czech Republic, Slovakia and Romania. The dreams and hopes that drove the anti-Communist revolutions of 1989 are not yet dead, but are fading. What went wrong?
These countries are among the most ethnically homogenous in the world, due to the Holocaust and the widespread ethnic cleansing that followed both world wars.
They have admitted almost no refugees, yet their politics is dominated by the fear of being swamped by them.
It's bizarre, but Bulgarian political philosopher Ivan Krastev has an explanation for it. He says the question "isn't so much where the nationalism has come from, but where it's been hiding ..." He says it was hiding in plain sight.
During the 1970s and 1980s the nationalists who wanted independence from Soviet rule formed a close alliance with the pro-Western activists who wanted a liberal, democratic future. From Poland to Bulgaria the liberals and the nationalists worked together, and even after the overthrow of the Communists in 1989 they continued to believe (or at least hope) that democracy could accommodate them both.
But the nationalist wars that destroyed the former Yugoslav federation in the 1990s ended the partnership. The liberals broke their alliances with the nationalists, and for a while the nationalists went quiet.
But nationalism was the most powerful political force in Eastern Europe in the 20th century, and wasn't going to die. It re-emerged in the early 21st century, shorn of its liberal associations with tolerance and diversity, and the driver behind it was what Krastev calls "demographic panic".
After 1989 many people in Eastern Europe not only aspired to emulate the prosperous liberal democracies of Western Europe, they wanted to live in them, and when their countries joined the EU they acquired the right to free movement. If Poles thought life would be better in England, for example, they could move there - and a million did.
Since 1989, 27 per cent of Latvians have emigrated to Western Europe, and Bulgaria has lost 21 per cent. Hungary has lost 3 per cent to Western Europe in the past 10 years and almost all the emigrants are young, leaving behind an ageing population with a low birth rate.
This is the source of the demographic panic, but it finds its political expression in paranoia that the dwindling population will be overrun by immigrants with a radically different culture, particularly refugees.
It doesn't matter that there are virtually no immigrants in Hungary, and that it's about the last place a refugee would wish to go. Perception is all.
The anti-immigrant hysteria is almost universal in Eastern Europe, and will bring more illiberal regimes to power. The remedy, if there is one, is for the liberals to acknowledge the nationalists' concerns and rebuild alliances with them without pandering to the panic.
That's not easy to do, but it's what every Western European democracy has actually been doing for generations. Although they're not doing too well with it at the moment themselves.
• Gwynne Dyer, is a London-based independent Canadian journalist, columnist and military historian.