Turkey's political leaders have a taste for high drama. Until a few days prior to the 30 July verdict, it had appeared a near certainty that the country's constitutional court would uphold an indictment calling for the ruling Justice and Development Party (AKP) of Prime Minister Recep Tayyip Erdogan and President Abdullah Gü to be banned for supposedly pursuing an Islamist agenda, contrary to Turkey's founding secularist principles.
One MP told me bleakly that he was "90 per cent sure" his party would be outlawed. Instead, after nearly five months of deliberation, the court's 11 judges rejected that option by a single vote. Turkey had stood, according to the newspaper columnist Ömer Taspinar, on "the brink of political suicide and miraculously managed to survive".
The court's decision was seized on by some in AKP as evidence that the balance of power in Turkey had swung further in favour of the ruling party at the expense of a secular elite that AKP sees as being out of touch with the realities of Turkish life beyond the upmarket neighbourhoods of Istanbul and Ankara.
"This decision shows that the exclusive state elite cannot get its way, despite everything it has been trying since last year," the AKP MP Suat Kiniklioglu told me.
In calling elections a year ago, and winning them by a landslide, Erdogan was hailed for having stared down the threat of a secularist-backed coup after Turkish military leaders expressed concerns over the nomination of Gü - a practising Muslim whose wife wears a headscarf - to the presidency. Now Erdogan has stared down the threat of a "judicial coup" as well.
Ultimately, however, the court's decision appears to be grounded in pragmatic rather than ideological considerations. Since coming to power in 2002, AKP has been credited with bringing good governance and fiscal competence to Turkey, triggering a surge of investment and prosperity in the party's Anatolian heartland.
Internationally, Turkey has established itself as a key player in the Middle East, hosting peace talks between Israel and Syria and wielding major influence, through military force, diplomacy and investment, in Iraq. Meanwhile, AKP has continued to forge closer ties with the EU.
Turkey's international standing would have been critically undermined by a verdict against AKP. Perhaps more critically still, last month's bombings in Istanbul, in which 17 people died, provided a fresh reminder of the real security threats, both Kurdish and Islamist, that Turkey faces, and beside which all other political distractions pale.
But the case raises fundamental issues. In February the same court overturned AKP efforts to lift a ban on the wearing of headscarves in universities - still the most emotive and divisive issue in Turkish politics. With ten of the court's 11 judges agreeing that AKP had become a focal point for anti-secularist activities, the country remains caught in a power struggle between an Establishment loyal to the Kemalist founding principles of the republic and the agents of a new, more democratic Turkey that is comfortable with its Islamic traditions. That argument is not going to be resolved without painful constitutional reconstructive surgery.
Still, it is a sign of Turkey's political progress that the members of a predominantly secularist court had the sense to retreat from the edge of a precipice over which their predecessors might once have stepped without hesitation.
"Turkey has to have the political maturity to talk about these issues," says the political analyst Ibrahim Kalin. "Along the way I think the more extreme voices will be eliminated."