Turkey's Foreign Minister Abdullah Gul has failed to gain enough support in parliament to become Turkish president.
Abdullah Gul is expected to be elected president
Mr Gul, the ruling AK Party's candidate, won 357 votes - 10 short of the two-thirds required.
The opposition Republican People's Party (CHP) has said it will challenge the election in court because not enough deputies were present.
Secular opposition parties want to stop the Islamist-rooted AK Party from winning the presidency.
CHP boycotted the vote because it was not consulted on Mr Gul's selection as the AKP's candidate.
CHP says it will challenge the election in court because only 361 MPs were present at the vote, fewer than the 367 (two-thirds) it says is required for a quorum.
The AKP, which holds more than 350 seats in parliament, had said only one-third of MPs were required for the vote to be acceptable.
"It is clear there were not the required 367 members present, so we are making our application to the court [to annul the election]," senior CHP deputy Haluk Koc said.
A second round of voting is due on Wednesday and the constitutional court has said it will try to rule on the appeal before the vote.
President chosen by 550 MPs
Two-thirds majority (367) needed to win in first or second round
Simple majority (276) needed if the contest reaches later rounds
Opposition want vote invalid if under 367 MPs attend
Parliament speaker insists usual quorum of 184 will suffice
If the court backs CHP's appeal, Prime Minister Recep Tayyip Erdogan will be forced to call a general election.
But if it backs the government, Mr Gul is expected to win in the third round of voting on 9 May, when he needs just 276 votes.
Mr Gul's only opponent in the election - Ersonmez Yarbay, also an AK deputy - dropped out of the running on Friday.
"The opposition wants to bring two candidates face-to-face with each other by not joining the vote. So, I withdraw my candidacy," Mr Yarbay said.
The modern Turkish state was established on strict secular principles and traditionally, the country's presidents have been secularists.
If Mr Gul is elected he will be the first incumbent to have Islamist roots, and the first president whose wife wears an Islamic headscarf.
Secularists fear that a president from the AKP - the initials of the Justice and Development Party - could undermine Turkey's secular order.
Mr Gul was named the AKP candidate on Tuesday by Prime Minister Erdogan.
The decision came after thousands had taken to the streets to urge Mr Erdogan not to stand.
After his nomination, Mr Gul pledged to adhere to the republic's secular principles if he were elected.
Officially, the Turkish president's duties are largely ceremonial and the post is regarded as less powerful than that of the prime minister.
But the presidency, first held by the revered founding father of the modern Turkish Republic, Mustafa Kemal Ataturk in the 1920s, holds tremendous symbolic importance for Turks, the BBC's Pam O'Toole reports.
The president has limited constitutional powers, including the ability to veto legislation. That was done on a few occasions by current incumbent Ahmed Necdet Sezer, a staunch secularist, in response to AK-driven bills.