Gul has laughed off suggestions that he harbours a secret Islamist agenda [AFP]
The Turkish parliament has elected Abdullah Gul, the current foreign minister, as president after a third round of voting.
However, political analysts said that Gul faces an important test in allaying fears that his term will raise the role of religion in public life.
Voting began at 3pm (12:00 GMT), and the ruling Justice and Development Party (AKP), which holds 341 seats in the 550-member parliament, had no trouble in installing Gul, 56, as president.
The AKP only needed an absolute majority to secure the post. In the previous two rounds in the chamber they failed because a two-thirds majority was required.
Two other candidatesa also stood for president.
General Yasar Buyukanit, Turkey's armed forces chief, said on Monday he saw "centres of evil" seeking to undermine the secular republic, a statement suggesting the army would not stand on the sidelines if it saw the separation between mosque and state threatened.
"The Turkish Armed Forces will not make any concessions ... in its duty of guarding the Turkish Republic, a secular and social state based on the rule of law," Buyukanit said in a written message.
Barnaby Philips, Al Jazeera's correspondent in Ankara, said: "The army sees itself as the guardian of the secular constitution [but] Gul laughs off suggestions that he harbours a secret Islamist agenda."
Turkish Milliyet newspaper said: "Gul's election will be a turning point in our political history that could draw us one step closer to democratic maturity."
Liberals dismiss concerns over the secular system - a defining feature of the Turkish republic - as "fear-mongering" undertaken by political rivals unable to match the AKP's rising popularity.
They see Gul's presidency as symbolic of the rise of the conservative and impoverished masses who form the backbone of the AKP - people who have long been kept at the margins of politics by the army-backed secularist elite, critics argue.
Turkey's popular Vatan newspaper said: "Gul will not have an easy start. His every step ... will be under scrutiny by institutions and sections of society who are sensitive on secularism.
"Gul will neeed to be careful and make efforts to calm them."
The headscarf debate has beleaguered Gul [AFP]
When Gul first stood for the presidency in April, the opposition blocked his election by boycotting parliament, while the army, which has ousted four governments since 1960, warned the government that it was "ready to defend" the secular order.
The crisis forced Recep Tayyip Erdogan, the Turkish prime minister, to call early general elections on July 22, from which the AKP emerged with a huge victory, hailing it as popular support to re-nominate Gul.
Opponents charge that the AKP has a secret agenda to replace Turkey's secular order with a regime more akin to an an Islamic republic.
Hardline secularists are also irritated by the fact that Gul's wife wears the Islamic headscarf, which they see as a symbol of defiance of the secular system.
But a survey published in Milliyet on Tuesday showed that the majority of Turks - 72.6 per cent - have no objections to a first lady with a headscarf, while 19.8 per cent said they would be annoyed if she covers up.