By Sarah Rainsford
BBC News, Ankara
The decision to hold an early general election has been welcomed across the board in Turkey as the best way out of the current political crisis.
Man with a past? Mr Gul says he is a moderniser
The country was thrown into turmoil by the decision of the governing AK Party, or AKP, to nominate Foreign Minister Abdullah Gul as its candidate for president.
His party calls him a moderniser and pro-EU, a man committed to the secular values of modern Turkey.
But Mr Gul's critics claim he remains loyal to his pro-Islamic political past and a danger to the republic.
His candidacy sparked two of the biggest demonstrations the country has seen in many years.
Even Turkey's powerful generals felt compelled to issue a statement warning that the military would act in defence of secularism if required.
But the AKP is the most popular party in the country, and compromise looked impossible.
'Bullet against democracy'
So the constitutional court was called in to adjudicate on a presidential election for the first time in its history.
Under intense pressure, Turkey's highest court swiftly ruled the first round of voting invalid, insisting on a quorum of two thirds of the assembly for a presidential vote.
Mr Gul's headscarf-wearing wife is a source of concern for some critics
Prime Minister Recep Tayyip Erdogan condemned the verdict as "a bullet fired against democracy".
But he quickly seized the political initiative and called for an early general election instead.
"Let's go to the nation!" he declared. "Let the people decide."
Erdogan is clearly calling 'I dare you,'" according to Turkish Daily News columnist Mehmet Ali Birand. "This is the only way out of such confusion."
The vote for a new parliament will be held on 22 July.
The opposition hopes the AKP will be weakened at the polls, perhaps even forced into a coalition. That way it would be compelled to compromise over its choice of
candidate for president.
But some analysts already predict this crisis will actually have handed the governing party more support come election time.
It certainly seems to have bounced back fighting.
The AKP is now pushing a package of proposals, including one to have the president chosen directly by the people, instead of by parliament.
"The AKP is trying to show that it is a major determining political actor, whatever the system," believes Istanbul Professor Ilter Turan.
"By making these proposals, the prime minister is making the point that in a free vote, it would be more than reasonable to expect that an AKP candidate would be most popular. This strategy is a shot fired at the opposition," he said.
But this entire crisis came about because of a perceived challenge to the core value of modern Turkey - secularism.
Even those who do not subscribe to claims that Abdullah Gul and the government harbour an "Islamic agenda" for Turkey argue that the government pushed the system to its limits by nominating Mr Gul for president.
He is still the official candidate of the party, but few here believe the AKP can afford a repeat performance.
"What happened here proves that ruling Turkey is not only about controlling the economy, it's about understanding people's concerns and sensitivities," wrote Ertugrul Ozkok in the daily newspaper, Hurriyet, on Thursday.
"The government has to see those people who staged demonstrations for secularism. They are the ballot box."
Professor Turan says: "I think the AKP has been made aware of the limits of what is possible here. It may be that as a result the government redefines how it plays politics."
Key to that would be nominating a candidate who did not belong to a pro-Islamic party before joining the AKP, and who does not - or whose wife does not - wear the Islamic headscarf.
"That part is a symbolic problem. Many people feel that allowing someone whose wife covers her head to the presidential palace in Cankaya would challenge the modern, secular values of the republic. So we may be looking at a compromise," Professor Turan says.
And what of the military?
Despite reforms to loosen the generals' grip on Turkish politics, the sharp statement they issued on Friday showed that the military has not renounced its duty as guardian of the secular state.
The EU has expressed its concern at the generals' intervention, but that is unlikely to affect them unduly.
"The General Staff will not say: 'Oh well, we have done what we could,'" warns Mehmet Ali Birand, suggesting the military will continue to observe events very closely.
"I'm not saying the government should do what the military says. But the General Staff's e-memo, whether we find it right or wrong, should also be taken into account with each step.
"The opposition should give up on provoking the military and the government should be more perceptive in the steps it takes."