Earlier the Turkish prime minister asked parliament to declare early general elections for June 24, opening the way for an easing of tensions with the secular establishment.
Recep Tayyip Erdogan made the request on Tuesday night in response to secularists' fears that his government, by proposing a candidate for president with an Islamic background, would allow religion to have more influence over politics and so undermine their Western way of life.
By holding early general elections, Erdogan hopes to resolve a crisis that has sent the stock market tumbling and prompted the pro-secular military to threaten to intervene.
Going to the people
"The parliamentary system has been blocked ... We are urgently going to the people. Our people will make the best decisions," Erdogan said on television.
The constitutional court ruled that not enough parliamentarians were present when the first round of the presidential vote was held in the 550-seat assembly on Friday.
The secularist establishment
says Erdogan and Gul, who is foreign minister, want to break the separation of state and religion, but the two men have rejected the charge.
Analysts say early national polls are the only way to defuse the standoff.
Secular groups have been calling for early national polls which were initially scheduled for November.
They want the secular system established by the founder of modern Turkey, Mustafa Kemal Ataturk, 84 years ago, to be retained.
But a growing class of prosperous and more religious-minded Turks want a relaxation of curbs on religious symbols and expression.
Erdogan's AK Party is widely expected to win the presidential polls, but the standoff has rattled Turkey's financial markets, recording their biggest falls in a year on Monday.
"I told EU officials Turkey would return to a more democratic process with elections"
Recep Tayyip Erdogan, Turkey's Prime Minister
The Turkish currency lost more ground on Tuesday as concern grew about possible instability after an anti-government rally of up to one million on Sunday and the army's threat to intervene in politics to prevent an Islamist president from the threatening the country's secular constitution and identity.
Erdogan tried to sound a positive note on Tuesday.
"I see Turkish markets will improve in the next few days with our positive steps in politics," he said.
"I told EU officials Turkey would return to a more democratic process with elections, and the democratic process in Turkey will successfully continue."
The government has also made remarks in a display of unprecedented defiance against Turkey's military generals.
"In democracies there is no better way of making warnings [to the government] than ballot boxes," Erdogan said.
The Turkish army has ousted four governments since 1960, the last in 1997.
Barnaby Phillips, Al Jazeera's correspondent in Ankara, said the court ruling was a clear defeat for the ruling party and there was disappointment within.
"Senior AK Party officials have told us they did not expect this verdict," he said.
Parliament will vote again on Wednesday before an election date is set, government officials said.
Phillips said the AK Party may go to parliament anyway and try and resume the process of getting Gul elected as president.
Phillips said they may be hoping to do a deal with some of the smaller parties, particularly with the Motherland party which has about 20 members.
"If they do succeed in winning them over, they may succeed in getting the majority that they need to get Abdullah Gul elected as president."
Source: Al Jazeera and agencies