WARSAW — What is one to make of Poland, hopefully without getting whiplash along the way?

One Poland buzzes with youthful optimism: the economic success story of post-1989 Europe on daily show not just in the fast-rising high-rises of downtown Warsaw, but across the country. Its dynamism is the envy of Europe.

Another is ill-tempered and divided, obsessed with quarrels with each other and its neighbors — Germany and Brussels above all. This Poland looks inward and backward. “History is the new religion,” says one right-leaning politician.

There’s the Poland where every Uber driver, seemingly, is a Mykhailo or Andriy recently arrived from Kharkiv or Odessa, one of a million Ukrainians who work here legally. Warmly welcomed, too, since Poland is short of labor with unemployment around 4 percent. This country is clearly at ease with open borders: As Ukrainians and Belarusians move in by the tens of thousands, between 2010 and 2014, nearly one in 10 Poles emigrated, mostly to Western Europe.

There is also, of course, the other Poland that sees an existential threat in open borders, and is staunchly opposed to any EU effort to accommodate migrants flooding up from the south. This country looks with skepticism at the EU and fights with Brussels over refugees or the rule of law at home, stirring talk of a "Polexit" from Europe. And then there’s the Poland that, in poll after poll, expresses more support for the EU than any other member country.

Liberalism and the EU are, really, your parents’ thing.

The contradictions pile on. The country, as one European savant puts it, belongs on a shrink’s couch.

* * *

How comforting it would be to attribute these split personalities to some uniquely Polish disease of the collective mind. Yet here you have symptoms found across the Continent, only in starker relief. In them lie clues to Europe's future.

The apparent disconnect between the success of open economies and the rise of closed politics is the most striking and universal.

As noxious as politics are said to be these days across Europe, the economic picture hasn’t been this rosy for a decade or more. The turn to populism, anywhere in the Western world (including Donald Trump's America) but above all in Poland, is by now hard to attribute primarily to economic hardship or a hangover from the financial crisis of a decade ago.

Poland’s economy is tops among the EU28, expanding at four times the bloc's average. Warsaw is Europe’s fastest-growing metropolitan region. Tech is the boom's engine: Poland’s early cultural embrace of most things digital, combined with an educational focus on tech, created the ideal conditions. One German bank chief calls Poland “the Bangalore of Europe,” the IT back-office for the Continent’s banks and corporations. One example: Goldman Sachs’ second-largest outpost in Europe, after London, is in Warsaw.

The rejection of what we might call “Euro-liberal mainstream” politics in 2015, when the right-wing Law and Justice party pushed the center-right Civic Platform from power, had little to do with economics. Here was a Polish version of Viktor Orbán’s “illiberal democracy” built on blood, soil and the fear of the "other," i.e. the migrant (Muslim, mind you, not Ukrainian). This was not the White Underemployed Male’s cry for help. Poland doesn’t have either stagnant wages or lingering scars from the 2008 crisis, which passed it by altogether.

There is, of course, no immutable link between economic health and liberal democracy. Good economic times, if anything, seemed to make the Poles even more willing to take a risk on a new set of rulers. Especially after a decade in power of a previous set that stood accused, not unfairly, of arrogance and corruption.

The shift toward nationalism and identity politics, in addition, is not necessarily at odds with the seeming cosmopolitan and future-oriented vibe of contemporary Poland.

True, many supporters of the ruling party are rural and poorer. But there are also many younger, urban Poles who find liberalism dated, reject the idea that Brussels knows better and back Law and Justice. A new generation gap cuts off those below the age of 35, the Poles who only vaguely remember life without open Schengen borders, much less communism.

Liberalism and the EU are, really, your parents’ thing. “It’s not cool anymore,” says Helena Chmielewska-Szlajfer, a Polish sociologist and author. “Now the pro-Europeans are the old establishment. People are rebelling against it. They aren’t thinking in grand narratives anymore; they are more practical. And people don’t associate free travel” — and all the other good changes in their lives — “with the EU.”

Before anyone in Brussels invokes the billions in aid that has gone Poland’s way since it joined the EU in 2004, remember that people don’t like to be seen as charity cases. Not when they have so much reason to think they made Poland successful largely on their own. Red Is Bad, a company that specializes in patriotic fashion accessories, proudly advertises it never got any EU funds.

Sooner or later, though, choices will need to be made. Practically speaking, Poland can’t benefit from the EU’s free trade, above all with Germany, and jump ship like Britain did. It won’t be able to isolate itself with Budapest, Bucharest, maybe the young anti-refugee chancellor in Vienna, and claim a significant say over what happens in Berlin, Paris and Brussels.

The gap between openness of borders and attitudes that has built up these modern miracles (and they are miracles for anyone who saw where this journey from the communist era started nearly 30 years ago), and the petty fights with Brussels that mainly serve the interests of politicians in power, can’t continue to grow without costly consequences.

* * *

What choices and compromises Poland makes with itself and with the EU will help determine where Europe ends up.

Some European elites would like to see the back of Poland, and never backed enlargement to the east in any case. But imagine a post-Brexit EU without Poland: It's bleak. Along with Spain, Germany and France, Poland is the other large country at the heart of Europe that links the EU (one day, some hope, the eurozone) from the Mediterranean to the Russian border. It is the leading power in the most dynamic region in Europe. Without it, the EU would be a smaller, older island.

Somewhere in Poland's multiple guises is Europe's future.

For Berlin, rapprochement with Warsaw ranks close behind its partnership with Paris as the linchpin of 21st century Germany's European identity. Worried about the European backlash to their rising power, German officials are eager to form coalitions within the EU. That’s why in Berlin you hear wistful talk now about the now more stagnant Weimar trio of Germany, France and Poland working together to chart the EU's future. “We want to revive that,” says a minister in the German capital.

Somewhere in Poland's multiple guises is Europe's future. It is dynamic, prosperous; it is potentially less free — a rejection of the consensus on liberal democracy and free markets in place since the fall of the Berlin Wall; it is either a great boon or grave threat to the European Union.

The one thing that can be said with certainty is that any outcome is imaginable.

Matthew Kaminski is executive editor of POLITICO's European edition.