The governing Justice and Development Party (AKP) had failed to get Gul elected in the first two rounds of voting held last week, with its 340 seats falling short of the required two-thirds majority. The other two contenders -- Sabahattin Cakmakoglu from the right-wing Nationalist Action Party and Tayfun Icli from the centre-left Democratic Left Party -- got 70 and 13 votes respectively in Tuesday's ballot.
The AKP, denies that it has an Islamic agenda and Gul has repeatedly pledged that his priority during his seven-year term will be to uphold the separation of state and religion. On the eve of Tuesday's vote, the head of the Turkish army warned that the secular system was under attack from "centers of evil seeking to systematically erode" it.
Liberals dismiss the secularists' concerns as "fear-mongering" by political rivals unable to match the AKP's rising popularity. They see Gul's presidency as symbolic of the rise of the relatively poor, religiously conservative masses who form the backbone of the AKP -- people who have long been kept on the margins of politics by the secular establishment.
When Gul first ran in April, the opposition blocked his election by boycotting the vote in parliament, while the army, which has ousted four governments since 1960, warned that it was ready to defend the secular regime. The crisis forced Prime Minister Recep Tayyip Erdogan to call early general elections on July 22, from which the AKP emerged with a huge victory it saw as a popular mandate to re-nominate Gul.