By Sarah Rainsford
BBC News, Ankara
The chief prosecutor wants to ban prime minister Erdogan from politics
Eight months ago the AK Party (AKP) was returned to power in Turkey with 47% of the vote.
Prime Minister Recep Tayyip Erdogan – the AKP's founder and its driving force – greeted a jubilant crowd outside the party headquarters in Ankara, as fireworks popped and passing cars hooted their horns in celebration.
Now that same party is to go on trial, accused of aiming to transform this strictly secular country into an Islamic state.
"This risk has been increasing every day" states the 162-page petition submitted to the constitutional court by Turkey's chief prosecutor.
"The danger is clear and concrete. There is no other way to protect society than to close the party down," it reads.
On Monday, 11 judges voted unanimously to hear the case - which also calls for the prime minister, president and 69 other party members to be banned from politics.
"Constitutional War!" was how one newspaper described the move the following day; another called it a "judicial coup".
EU Enlargement Commissioner Olli Rehn warned the case could jeopardise Turkey's accession bid - arguing such disputes should be resolved through the ballot box, not the courts.
The AKP was formed after a previous pro-Islamic party was banned. Its founders have since steered a moderate path, pursuing democratic reforms and directing Turkey towards the EU.
But they spent their political youth in the ranks of an overtly Islamist movement - and ardent secularists do not believe their views have changed.
The closure trial is not the first attempt to stop the party's rise.
As the AKP's Abdullah Gul looked set to become president last year, the military issued a veiled coup warning. The main secularist opposition party then contested the election process in the constitutional court, and won.
Undaunted, the AKP swept the board at an early general election, and Abdullah Gul became president soon after.
Many women in Turkey wanted the headscarf ban lifted
An alleged plot to incite armed revolt against the government has since been uncovered. Dozens of suspects have been arrested and explosives seized - but no indictment has yet been produced.
This latest move by the judiciary had been predicted. But the ultimate spark for the closure case was the AKP's attempt to lift a ban on the Islamic headscarf in universities.
"The headscarf is a product of religious fanaticism," chief prosecutor Abdurrahman Yalcinkaya declared in his petition to the court, outlining the "Islamisation-by-stealth" accusation often levelled at the AKP.
"The real aim of the party is not to remove obstacles to education, but to bring religion into education and into public institutions - and eventually overturn the secular state," the petition reads.
The AKP condemns the case as an assault on democracy.
"It's deeply regrettable that a party that won 47% at the elections is now presented with this case," AKP member of parliament Suat Kiniklioglu told the BBC.
"I don't agree at all that allowing women to wear a headscarf to university threatens the secular order," he added. "But I think the headscarf is not the issue here. It's whether Turkey should develop into a normal democracy, from one dominated by a state elite that manages everything as they see fit."
That view is frequently voiced here, as Turkey's traditional secularist elite wrestles for power with a new, devout urban middle class that sees the AKP as its representative.
The evidence now before the court though is intended to prove an Islamist agenda.
It includes government moves to ease access to university for religious school graduates; it talks of some local councils restricting alcohol sales and complains that the party is appointing state bureaucrats based on religious belief, not merit.
Together with the headscarf reform it is far from explosive. But the case has not emerged from a vacuum.
"In the past few months there has been a significant accumulation of the perception of threat among the urban middle class that is very sensitive about secularism," explains politics professor Ayse Ayata.
She argues the AKP has become arrogant, citing majority support as legitimacy for any move.
"Ardent secularists are the minority here, but they see the AKP talking more about religion and the headscarf and they worry what will happen to them. The AKP does nothing to address their concerns," she says.
Defying calls for compromise, the AKP seems set on changing the constitution to block this case - making it harder to close a party down.
Party officials shrug off any suggestion of foul play, arguing this fight was never fair.
"We have said many times before that the current procedure is wrong. Closing down a party should be the final solution, but at the moment it is the first," AKP Deputy Chairman Nihat Ergun told the BBC.
If the AKP fails to win opposition support for the reform, he says it will call a referendum – though that would be hugely divisive.
In the meantime the trial is expected to drag on for several months: bad news for Turkey's EU accession process and for investors. The constitutional court has a long history of banning political parties and a record of ruling against the government.
The AKP insists it will persist with its reform agenda regardless - even bringing the much-awaited reform of Article 301 to the agenda, to protect free speech. The article has been used to prosecute some prominent writers for "insulting Turkishness".
But as the AKP launches a fight for its political life, most here doubt that such reforms will be possible soon.