Abdullah Gul, the government's presidential candidate, failed to muster sufficient votes in parliament to be elected in a second round of voting Friday.
The 337 votes in favor of Gul were short of the two-thirds majority needed to be elected in up to four ballots in the presidential election process. Gul, who needed 367 votes, is almost certain to prevail on Aug. 28, when only a simple majority is required.
Two other candidates, Sabahattin Cakmakoglu, of a nationalist party, and Tayfun Icli, from a small center-left party, got 71 and 14 votes, respectively.
Secularists oppose Gul - a devout Muslim, who once was part of Turkey's Islamic movement - fearing he will undermine secular principles enshrined in the constitution, despite his track record as a reformer who has worked to steer Turkey toward EU membership.
Gul's nomination earlier this year sparked a political crisis, with millions taking to the streets in protest of his bid and the military - which has ousted four governments since 1960 - threatening to intervene to protect the secular system.
A parliamentary deadlock forced Gul to abandon his initial bid, but Prime Minister Recep Tayyip Erdogan re-nominated him as its presidential candidate, emboldened by his party's success in July's early elections.
Gul's wife wears an Islamic-style head scarf and secularists are horrified by the prospect of a first lady in Islamic attire, which modern Turkey's founder, Mustafa Kemal Ataturk, banned in daily life. The ban has been enforced in public offices and schools since a 1980 military coup.
Gul and Erdogan reject the title of Islamists and point to reforms they have carried out to advance Turkey's bid to join the EU.
More than 5.8 million people voted for Nicholas Maduro at the presidential election in Venezuela. This is more than a quarter of registered voters. Why did those people vote for the man, who, as Western media write, took Venezuela to the brink of collapse?
Putin's official spokesman Dmitry Peskov commented on remarks in the US media about failures in launching nuclear-capable missiles in Russia