Transforming society in his image over two tumultuous decades, Recep Tayyip Erdogan enters the fight of his political life in a May election overshadowed by the pain and suffering of Turkey's deadliest earthquake in centuries.

A gifted orator and strategic thinker, Erdogan, 69, has overcome jail, protests and even a bloody coup attempt to emerge as Turkey's most important leader in generations, first as prime minister and then as president since 2014.

Supporters revere him for unshackling religious restrictions in the officially secular but mostly Muslim state, overseeing ambitious infrastructure projects and turning Turkey into a geopolitical powerhouse.

Detractors accuse him of slipping into authoritarianism reminiscent of the Ottoman sultans, shaking Turkey's democratic foundations and impoverishing millions through misguided beliefs that contradict conventional economics.

Most recently, they accuse him of turning a blind eye to corruption and lax building standards that allowed entire cities to crumble in last month's earthquake, which killed more than 50,000 people and erased entire cities across Turkey's southeast.

Which of these radically contrasting views wins out in the May 14 vote will determine whether one of Europe's longest-serving leaders can extend his stay in office until 2028.

- Rewriting the rules -

Known to his inner circle as "beyefendi" (sir) and to admirers as "reis" (the chief), Erdogan prides himself on being able to woo doubters through tireless campaigning.

This passion has helped him and his party win more than a dozen local and national elections, giving Erdogan a chance to claim a people's mandate for his foreign military adventures and domestic clampdowns on dissent.

A risk-taker whose popularity began to waver in the second decade of his rule, Erdogan bet it all on a 2017 referendum on abolishing the office of prime minister and handing added powers to the president.

Erdogan eked out a narrow win, enfeebling parliament and enabling him to effectively rule by decree.

It also gave him the constitutional loophole needed to run for two more terms in office.

But this year's presidential election campaign will be like no other of the Erdogan era, starting after a month of national mourning for the quake on February 6.

Public fury at the government's sluggish response to Turkey's biggest disaster of its modern era made some allies urge Erdogan to postpone the vote.

Unbowed, Erdogan decided to push ahead. But he also banned music from his campaign stops, setting a sombre tone to the most difficult election test of his colourful career.

- Power and protests -

Born in a working-class harbour district of Istanbul, Erdogan made his name in nascent Islamic movements that were challenging secular domination, becoming the city's mayor in 1994.

His term in office was cut short when he was convicted and jailed for four months for inciting religious hatred when he recited a fiery poem that compared mosques to army barracks and called minarets "our bayonets".

Among supporters, this only seemed to magnify his appeal.

Founding the Justice and Development Party (AKP) after an earlier Islamic party was banned, Erdogan spearheaded its 2002 landslide election victory and became premier less than six months later.

Erdogan's signature early achievements included a series of reforms that gladdened the European Union, including abolishing the death penalty and beginning a peace process with Kurdish militants.

Mass protests in 2013 over plans to turn an Istanbul park into a shopping mall marked the start of a more divisive era that included corruption allegations levelled against his inner circle.

Turkey's bid to join the EU faltered and peace talks with the Kurds imploded in 2015, when a Kurdish opposition party helped to wrest control of parliament from Erdogan for the first time.

A series of Turkish military operations against Kurdish forces in Syria and Iraq soon followed, creating new tensions with the West.

- Abandoned by allies -

In its early days the AKP, lacking allies and experience, forged an alliance with Islamic preacher Fethullah Gulen, who moved to permanent US exile in 1999 but retained strong influence in Turkish society and government.

Erdogan blamed Gulen for masterminding a bloody July 15, 2016, coup bid by a renegade army faction, charges he denies.

The president, on holiday in the Aegean, appeared on the FaceTime app on live TV to urge supporters out onto the streets.

It became the defining moment of his subsequent rule.

Erdogan fought back with sweeping purges that led to 80,000 arrests, brought most media under government influence and created a sense of looming peril among those opposed to his rule.

Washington and the EU's hesitation to openly support Erdogan in the first hours of the coup bid eroded his trust in the West and created diplomatic frictions that linger to this day.

Abandoned by many of his former allies, who joined opposition ranks, Erdogan began to rely on his family for guidance.

One of his sons-in-law, Berat Albayrak, oversaw swathes of the economy until 2020, while another, Selcuk Bayraktar, built the Baykar drone company.

The drones helped swing the outcomes of wars in Nagorno-Karabakh and Libya, enabled Ukraine to defend Kyiv against Russian invaders, and allowed Turkey to pursue a more punishing campaign against Kurdish forces.