By Chris Morris
World affairs correspondent, BBC News
These are tense times in Turkey, as the country enters uncharted political waters.
Pro-secular supporters held a huge rally in Istanbul on Sunday
Never before has the constitutional court annulled a presidential election.
Never before has a sitting prime minister accused the country's leading judges of firing "a bullet aimed at democracy".
The court ruling, coming just a few days after an ominous warning from the military about the government's plans for the presidency, means Turkey's political system has reached deadlock.
An early general election, producing a new popular mandate, is probably the only way out of the impasse.
Parliament has now agreed that the election will take place on 22 July and the campaign will certainly be passionate. There are big issues at stake.
It is possible that the governing AK Party could emerge with an even bigger majority than it has now.
There will be much talk of opposition alliances to try to prevent that from happening.
But this is part of a longer term political battle about what kind of country, what kind of democracy, Turkey should be.
The army, the main opposition party and powerful vested interests in the bureaucracy and the judiciary all believe that secularism is Turkey's founding principle, and its guarantee of modernity.
But the government argues, in effect, that too strict a definition of secularism damages democracy, and restricts personal freedoms.
Although his opponents doubt him, Prime Minister Recep Tayyip Erdogan says he too is committed to secularism.
But he does not think it should be at the expense of Turks who want to express their religious beliefs more openly.
"The essential problem is to find a way to stay united, preserving our differences", he says. "Rights and freedoms are necessary for everybody."
Many Turks fear that Islamists are using the EU accession process for their own ends
And "everybody" includes women who wear the Islamic-style headscarf - women who include his own wife and the wife of Abdullah Gul, Mr Erdogan's choice for president.
But the idea of a "covered woman" in the presidential palace is seen by staunch secularists as an unacceptable symbol.
That is especially true of the armed forces, which have intervened directly in Turkish politics on several occasions in the past.
Do not expect tanks on the streets and soldiers surrounding parliament again - that will only happen if things really spiral out of control.
This time, the generals simply posted a statement on the internet (an e-coup was one impolite description).
The statement accused the government of tolerating rising Islamist activity and threatened to take unspecified action.
Any military interference in politics, though, even a statement on a website, does nothing for Turkey's image abroad, particularly in Europe.
The European Commission has already warned that "the supremacy of democratic civilian power over the military" is a prerequisite for any country hoping to join the EU.
But nationalists in Turkey (some but not all of them secular) have already become increasingly critical of EU demands for reform.
Many Turks fear that Islamists are using the EU accession process for their own ends - trying to dismantle the secular system under the guise of democracy.
There is no doubt that both Mr Erdogan and Mr Gul held fairly radical Islamist views in their youth.
But they both insist they have changed, and for the past five years they have led a government which has reformed and modernised the country faster and more effectively than most of its predecessors.
That has led many Western leaders - George Bush and Tony Blair among them - to argue that Mr Erdogan's government can become a powerful example for Turkey's neighbours in Iran, Iraq and Syria.
Proof, they say, that Islam and democracy can go hand in hand.
But that cuts no ice with the prime minister's domestic critics.
They distrust him fundamentally. On this central issue he leads a nation divided. Now he will ask the people to show where they stand.