ANKARA, TURKIYE -- Turkish President Recep Tayyip Erdogan has remained in power for 20 years by repeatedly surmounting political crises: mass protests, corruption allegations, an attempted military coup and a huge influx of refugees fleeing Syria's civil war.
Now the Turkish people and economy are being pummeled by sky-high inflation, and many are still recovering from a devastating earthquake in February made worse by the government's slow response.
Yet Erdogan -- a populist with increasingly authoritarian instincts -- enters a runoff election Sunday as the strong favourite against opposition leader Kemal Kilicdaroglu after falling just shy of victory in the first round of voting. So, even with a weak hand, what explains his longevity and wide appeal?
Erdogan, 69, has cultivated deep loyalty from conservative and religious supporters by elevating Islamic values in a country that has been defined by secularism for nearly a century.
He has tightened his grip on power by deploying government resources to his political advantage -- lavishly spending on infrastructure to please constituents, and strictly controlling the media to silence criticism.
And he has swayed many Turks to his side by the way he navigates the world stage, showing that his country has an independent streak -- and can flex its military -- as it engages with the East and West.
Erdogan's popularity at a moment of economic crisis also seems to be derived from the mere fact of his endurance; many people seem to want some stability, not more change, according to interviews with voters and analysts.
"During times of national crises such as this one, people usually rally around the leader," said Gonul Tol, an analyst at the Middle East Institute in Washington. "The voters don't have enough faith in the opposition's ability to fix things."
Already Turkiye's longest-serving leader, Erdogan would stretch his rule into a third decade -- until 2028 -- if he were to secure a majority of votes in the runoff.
He received 49.5% of the votes in the first round -- four percentage points ahead of Kilicdaroglu, a social democrat who has led the country's main opposition party since 2010. And on Monday Erdogan won the endorsement of the far-right candidate who finished in third place, giving him a boost heading into the runoff.
Kilicdaroglu, an economist and former member of parliament, is the joint candidate of a six-party coalition alliance. He has promised to undo Erdogan's economic policies, which experts say have stoked inflation, and to reverse Erdogan's increasingly authoritarian leanings, including crackdowns on free speech. But his campaign has struggled to entice Erdogan supporters.
"Look at the stage our country has arrived in the last 20 years. (The opposition) would take us back 50-60 years," said Bekir Ozcelik, a security guard in Ankara, who voted for Erdogan. "There is no other leader in the world that measures up to Erdogan."
What Ozcelik and many other supporters see in Erdogan is a leader who has shown that Turkiye can be a major player in geopolitics.
Turkiye is a key member of NATO because of its strategic location at the crossroads of Europe and Asia, and it controls the alliance's second-largest army. Under Erdogan's rule, Turkiye has proven to be an indispensable and, at times, troublesome NATO ally.
It vetoed Sweden's entry into NATO and purchased Russian missile defence systems, prompting the United States to oust Turkiye from a U.S.-led fighter-jet project. Yet, together with the U.N., Turkiye brokered a vital deal that has allowed Ukraine to ship grain through the Black Sea to parts of the world struggling with hunger.
After civil war broke out in Syria in 2011, Erdogan embroiled Turkiye by backing opposition fighters seeking to depose President Bashar Assad. The fighting triggered a surge of Syrian refugees that Erdogan has used as leverage against European nations, by threatening to open up Turkiye's borders and swamp them with migrants. And Turkiye now controls large swaths of territory in northern Syria, after a succession of military attacks aimed at Kurdish groups there affiliated with rebels that Turkiye has outlawed.
Erdogan has boasted about Turkiye's military-industrial sector on the campaign trail citing homemade drones, aircraft and a warship touted as the world's first "drone carrier" -- and the message appeared to resonate with voters on May 14, analysts say.
On the domestic front, Erdogan has raised Islam's profile in country whose secular roots are fraying.
He has curbed the powers of the once staunchly secularist military and lifted rules that barred conservative women from wearing headscarves in schools and government offices. To further rally his conservative supporters, Erdogan has disparaged Kilicdaroglu and the opposition as supporting what he called "deviant" LGBTQ rights.
The biggest threat Erdogan faces at the moment is the economy. His primary method of attacking families' diminishing purchasing power has been to unleash government spending, which -- along with lowering interest rates -- only makes inflation worse, according to economists.
Erdogan has increased public-sector wages, boosted pensions and allowed millions of people to retire early. He has also introduced electricity and gas subsidies and wiped out some household debt.
He has also promised to spend whatever is necessary to reconstruct the vast quake-stricken areas. At each ground-breaking ceremony he attends, Erdogan says only his government can rebuild lives following the disaster that levelled cities and killed more than 50,000 in Turkiye.
Erdogan's party won 10 out of 11 provinces in the region affected by the quake, an area that has traditionally supported him -- despite criticism that his government's initial response to the disaster was slow.
Mustafa Ozturk, an Erdogan supporter in Ankara, said his standard of living has declined as a result of inflation. But the way he sees it, Turkiye isn't the only country struggling with inflation since the pandemic.
"It isn't Erdogan's fault," he said. Ozturk said he would never vote against Erdogan, saying he felt "indebted" to him for bringing Islam more to the forefront of society.
Erdogan's message -- and power -- are amplified by his tight control over the media.
The state-owned broadcaster TRT Haber devoted more than 48 hours of airtime to Erdogan since April 1, compared with 32 minutes given to Kilicdaroglu, according to Ilhan Tasci, a member of Turkiye's radio and television watchdog.
Kilicdaroglu's promise to repair the economy and uphold women's rights to wear Islamic headscarves in schools simply did not resonate in the country's conservative heartland.
"Kilicdaroglu changed the image of the (opposition) party, but Erdogan controls the narrative, so there is that fear factor" among conservative women who wear Islamic-style headscarves, Tol said. "They believe that if the opposition comes to power, they will be worse off."
After Turkiye's pro-Kurdish party backed Kilicdaroglu, Erdogan portrayed the opposition as being supported by Kurdish "terrorists." The opposition's efforts to refute this were rarely broadcast by the mainstream media.
Erdogan "meticulously crafted a run for victory that included leaning on state institutions, leaning on information control and demonizing the opposition as terrorists or (having) beliefs interpreted as insufficiently Muslim," said Soner Cagaptay an expert on Turkiye at the Washington Institute and an author of numerous books about Erdogan.
"The media switched the debate to how Turkiye has become an industrial military giant under him. And it worked," Cagaptay said.
During the first round of voting on May 14, Turkiye also held legislative elections, in which Erdogan's alliance of nationalist and Islamist parties won a majority in the 600-seat parliament. That gives him an additional advantage in the second round, analysts say, because many voters are likely to back him to avoid a splintered government.
"The parliament is overwhelming with us," Erdogan said last week in an interview with CNN-Turk. "If there is a stable administration, there will be peace and prosperity in the country."