Andrzej Duda's shock win in Poland's presidential election has capped a rapid rise from backroom obscurity to head of state, and may herald a new political chapter in eastern Europe's biggest economy.
Duda was a legal aide to conservative President Lech Kaczynski before his death in 2010 in a plane crash in Russia.
Now 43, Duda sees himself as spiritual and political heir to Kaczynski, recalling how, two days before the flight, the president told him that a generational change was afoot, and that it would be Duda and his peers who would take responsibility for the future of the country.
"When I remembered this after the crash, it sent shivers down my spine," Duda told Rzeczpospolita newspaper.
He quit when Bronislaw Komorowski won the subsequent presidential race for the ruling centre-right Civic Platform, becoming a local councillor, then a member of the Polish parliament and eventually a lawmaker in the European Parliament.
But he was still a relative unknown when the opposition Law and Justice party, now led by the late president's twin brother Jaroslaw, endorsed him for the presidential election.
Some observers described him as a stand-in for Jaroslaw Kaczynski, who they said was unwilling to risk running against the popular Komorowski.
Duda's unlikely victory, the conservatives' first major electoral success in nearly a decade, has Law and Justice smelling blood ahead of a parliamentary election in the autumn, with potential ramifications for Poland's standing in Europe.
"From our point of view, this election allows us to break the glass ceiling," said Law and Justice deputy leader Adam Lipinski. "It paves the way to a clear win in the parliamentary elections."
Born in the southern Polish city of Krakow, Duda is the son of two academics, and in his early years was a churchgoing and bookish boy scout. He earned a law degree, and later a PhD, from the Jagiellonian University, Poland's oldest academic institution.
In 2005, the year of Law and Justice's last parliamentary victory, Duda became an adviser to the party's parliamentary caucus, helping draft one of its flagship bills on vetting public officials who might have a communist past.
He went on to become deputy justice minister in the Law and Justice government, later joining President Lech Kaczynski as a legal adviser.
He was involved in a legal challenge to a bill introducing stricter state oversight over a network of Polish credit unions, drawing criticism from opponents who say this delayed the legislation and put the stability of the financial system at risk.
On 6 August, Duda will become Poland's sixth president since its transition from communism in 1989, having defeated Komorowski in spite of opinion polls before the first round that suggested the incumbent would comfortably win a second five-year term.
Komorowski, Duda's senior by almost 20 years, came off as lethargic, and failed to turn things around after the first-round defeat.
As head of state, Duda will be in charge of the armed forces, coordinating foreign policy with the foreign minister, signing or vetoing bills and drafting his own legislation. He will also appoint the head of the central bank.
That gives him and the Law and Justice party scope to change Poland's relationship with the European Union, until now built on close cooperation with Germany and other major players in the bloc. The party is less enthusiastic about Brussels, arguing that Warsaw should focus more on its own interests.
Duda has also suggested Poland should curb foreign ownership in the banking sector. About two-thirds of Poland's profitable and well-capitalised banking sector is foreign-owned.
He has also backed a conversion of mortgages denominated in Swiss francs into Polish zlotys at historical exchange rates, a move that would mean billions of zlotys in losses for the banks, and called for a new tax on bank assets like that adopted in Hungary under Prime Minister Viktor Orban.
"One has to work on the Polish economy, so that we start getting closer to real prosperity and not prosperity on paper," Duda said shortly before Sunday's run-off.
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies