IT IS one of Europe’s shining successes. Alone in the European Union, Poland did not suffer a recession after the financial crisis. Its economy has grown by 33% since 2007, compared with 2% for the euro zone. Its transport and energy infrastructure has been transformed. Poland has been a dependable partner for policymakers in Berlin, Brussels and Washington, DC. Even the French, ever suspicious of the EU’s eastern members, have started to court the country. As president of the European Council, Poland’s former prime minister, Donald Tusk, has become a central figure in European politics.

Yet Poles are fed up. President Bronislaw Komorowski, of the ruling centre-right Civic Platform party, narrowly lost a re-election vote in May. The prime minister, Ewa Kopacz, is heading for a crashing defeat in parliamentary elections in October. The danger for Poles is that, in throwing out a lacklustre government, the country may revert to a narrow, mistrustful populism, forsaking its own impressive gains.

Back to the Kaczynski era?

The new president, Andrzej Duda (pictured), took office this week and Poland’s allies are asking which face his party, Law and Justice, will present to the world. Will it retain the sensible centrism he campaigned on? Or will it fall back into the oddball prickliness of Jaroslaw Kaczynski, the party mastermind? Mr Kaczynski, whose twin brother, Lech, was president when he died in an air crash in Russia in 2010, fared poorly as prime minister in 2006-07, unleashing an arbitrary anti-corruption campaign and pursuing an erratic foreign policy. The standard-bearer for traditional Catholic values and rural interests, Law and Justice has championed countries in the Kremlin’s shadow, such as Georgia and Ukraine. It is mistrustful of big business and—lamentably—wants to cut Poland’s retirement age. It resents outside liberal meddling on gay rights and the like.

But the central question will be relations with its neighbour, Germany. Mr Kaczynski has accused Germany of scheming to recover land it lost to Poland after the second world war and Angela Merkel, its chancellor, of being a pawn of the Stasi, the former East German secret police (see article). Poland has real gripes, ranging from some German politicians’ softness on Russia to a lack of provision for ethnic Poles in Germany. Settling them calls for talks, not tantrums. Poland now outweighs Russia as a trading partner for Germany. That gives it influence—though this must be used wisely.

Nothing would please Russia more than a Polish-German split. And America, which Law and Justice reveres, values close ties between Berlin and Warsaw. Poland needs its friends. It wants the NATO summit in Warsaw next summer to respond to Russian threats by permanently basing troops on the eastern edge of the alliance. In the EU it—like Britain—wants assurances that the interests of countries outside the euro, the “outs”, will be safeguarded in decision-making dominated by the “ins”. It also wants a strong EU stance against Russian machinations over gas (though, as a heavy user of coal, it drags its feet on reducing carbon emissions). German support will be vital on these fronts, and is more likely if Poland looks sensible. Poland’s big asset in the EU should be Mr Tusk. Yet, perversely, many in Law and Justice want him fired.

Which course Poland takes will depend much on Mr Duda, who, as president, shares responsibility for foreign policy with the government. Born in 1972, he marks a shift in Polish politics from a generation whose outlook was forged under communism. Poles’ desire for political change is understandable, but their democracy needs two responsible parties, not just one. Mr Duda must prove he is not Mr Kaczynski’s puppet.