When Mustafa Kemal Ataturkfounded the Turkish Republic nearly a century ago, the former military leader banished religion from the public sphere and looked westwards to Europe for inspiration.
After replacing Islamic law (sharia) with European civil codes, he installed the principles of secularism into the Constitution, banned the Muslim call to prayer in Arabic and pushed for the social integration of the sexes, reforms which would radically alter the fabric of the Muslim-majority country which only years earlier was the seat of the Ottoman Empire.
And now, as Turkey prepares for crucial presidential and parliamentary elections, the debate as to whether the Muslim world's model democracy is abandoning its secular model has resurfaced.
But with millions of Turks expected to head to the polls on June 24, that successful juggling-act is being questioned.
Opposition groups have begun depicting the 64-year-old President as a 'Caliph-in-waiting' who seeks sweeping powers to change the country's laws to greater reflect its growing Muslim identity.
"There is a major paradox in the AK Party leadership," says Baris Yarkadas, an MP with the left-leaning and secularist CHP (Republican People's Party).
"One the one hand, the AK Party claims to be secular. On the other, they disagree with several of Mustafa Kemal Ataturk's views and want to tear down the republic."
Since the AK Party came to power [practising] Muslims can enjoy the same rights as others Turkish citizens
FATMA BENLI, ISTANBUL-BASED MP WITH THE AK PARTY
Overthrowing Ataturk's legacy?
Erdogan has repeatedly rebuked the claims, but a victory for his governing AK Party could reshape Turkish democracy for years to come.
Such a prospect is an anathema to secularists, with many asking whether Turkey is erasing the line between religion and state.
"Should they usher in an executive presidency they could overthrow the legacy of Ataturk," Yarkadas said.
Unencumbered by religion, Ataturk promoted ancient Turkish traditions and cultures as part of a series of reforms with the intent that nationalism would overcome the idea of an Islamic Ummah, or global Muslim community.
Building a state around a cadre of secularised elites, his ideas - known as Kemalism - blamed the demise of the Ottoman Empire on religion and altered virtually every aspect of Turkish life for the next eight decades.
Under several regimes, the political and legal system he founded prevented Muslims from exerting any significant influence in temporal affairs, with laws and the threat of force silencing pro-Islamic politicians.
"Secularism was forced on the people as if it were a religion," says Fatma Benli, an Istanbul-based MP with the AK Party.
Ataturk outlawed men from wearing the fez, and famously adopted a Panama hat to accent his Western suit and tie; a sample of the many ideas Benli says, which marginalised the predominantly Muslim population.
"I couldn’t go [to] the garden of my school because I wore the hijab," she says, describing a period during [the] 1980s and 1990s when the headscarf was banned in government offices, hospitals, universities, and schools.
"Since the AK Party came to power the situation has normalised, and [practicing] Muslims can enjoy the same rights as other Turkish citizens," she told Al Jazeera.
The AK Party, which styles itself as the ideological equivalent of a western European conservative Christian Democrat party, was formed in 2001, after its predecessor - the Virtue Party was shut down by the country's constitutional court due to its "anti-secular" activities.
It would steamroll to victory a year later, and push through liberal reforms, achieve unprecedented economic success - transforming a crisis-hit economy into one fuelled by trade and foreign investment - and sideline a military that had undermined Turkish democracy in a series of coups between 1960, 1971, 1980 and a 'post-modern coup' in 1997.
'Still inherently secular'
Over the 16 years that it has since been in power, the AK Party has been mostly pragmatic on the issue of religion and insists the country will remain secular, even if the country switches to an executive presidency.
In 2016, when AK Party politician and parliament speaker Ismail Kahraman suggested that the "irrevocable principles" enshrining secularism be removed from the constitution, Erdogan distanced himself from the remarks.
"Turkey may appear more Islamic now than it was a few decades ago, but when we look at the fabric of Turkish society, the country's politics are still inherently secular," says liberal Islamic theologian Ihsan Eliacik.
"In the last referendum, the ruling party won by only a small majority. And this illustrates how divided Turkish society is.
"Many people don't ascribe to Islamic values and in the upcoming election, there is a real possibility the AK party could lose its majority in parliament. Should this happen it will clearly defeat this notion that Turkey is an Islamist State."
Benli, the AK Party MP, adds that it is reductive and outdated to speak of Turkish politics strictly in terms of a divide between religion and secularism.
"Turkey has always been divided into groups, whether they be Turkish, Kurd, secular or non-secular. Such labels are incredibly dangerous and divisive.
"The AK party always has and continues to maintain that it is a democratic party."
Erdogan's supporters, however, argue an executive-presidency could enable the AK Party to revisit several controversial issues, and promote the socially conservative values and sentiments many hold.
'"Turkey is not Iran,'' says Mehmet Can, a 30-year-old computer programmer and AK Party supporter.
"Turkey practices its own brand of secularism and is simply challenging militant secularism."
Protecting 'pious' citizens
A common theme in Erdogan’s recent election speeches and rallies has been the dark period between the 1920s and early 2000s, when the secular elite ruled the country while so-called “pious” citizens were marginalised.
The military long considered secularism as a tool for the survival of the elite, and acted as the main deterrent should the outward trappings of conservatism rear its head.
After decades of brutal repression, the early 1990s witnessed a return of Islamic practices in the public sphere, but various power struggles remain centred on the issue since then.
Waiting in the wings, the military toppled elected governments three times (and a 'post-modern coup' in 1997), claiming responsibility as secularism’s ultimate guarantor.
When the country's first pro-Islamic prime minister, Necmettin Erbakan, was deemed to have veered too far from the secular path in 1997, generals forced him from power.
"The idea that secularism is now under threat is highly questionable," says Sevinc Dogan, an academic and author of the book, titled AKP in the neighbourhood.
The president has repeatedly said he is committed to secularism, but does not think it should be at the expense of Turks who want to express their religious beliefs in a more open manner.
"The CHP party (the party of Mustafa Kemal) has formed a coalition with the Saadet Party (Felicity Party) - a group which is far more conservative than the governing AK Party.
"So if the CHP - the party of Mustafa Kemal - fears the threat posed to secularism by Islamist groups, why would they be in an alliance with an Islamist group?" Dogan says.