ISTANBUL • The drama of the failed coup mostly played out across two urban spaces and the skies overhead - Istanbul, the sprawling megacity that symbolises Turkey's past as the seat of an Islamic empire, and Ankara, the utilitarian capital, a one-time backwater built up by modern Turkey's secular founder, Mustafa Kemal Ataturk.
Much of the violence occurred in Ankara, where different factions of the armed forces battled over government buildings. But the events in Istanbul proved crucial in fending off the coup. It was there that two private news channels broadcast anti-coup coverage and gave a platform to elected leaders, including President Recep Tayyip Erdogan.
Ankara may be the seat of Turkey's government, but it was Mr Erdogan's grip on Istanbul, a city he once governed as mayor, that was crucial in putting down the coup. He has spent far more time in Istanbul than previous Presidents and has overseen the construction there of Turkey's largest mosque.
He has also built up the police force, much of which is based in Istanbul. By stocking the force with loyalists and purging suspected enemies, he created a counterweight to the military, which has a history of coups against civilian governments.
And it was largely the police special forces that defended the government over the weekend, confronting the renegade military factions.
In the days before the attempted coup, a palpable sense of melancholy could be felt in the city. Turks call it "huzun", a rich, Arabic-rooted word that means melancholy and a lot more: loss, sadness, spiritual anguish. Turkey's most famous novelist, Orhan Pamuk, used it to describe Istanbul in the dreary years after the fall of the Ottoman Empire.
The word is back in the city's lexicon now, as years of optimism about Turkey's growing power on the world stage give way to anxiety over terrorism and internal conflicts.
After the coup was decisively put down, Mr Erdogan's supporters flooded the streets, their joy masked a deep unease that has enveloped the city.
"I think the city was presented as this perfect dream without its problems," said Mr Kaya Genc, a novelist. Now, he said, "is the return of the real Istanbul". By that he meant a mood more in sync with its unstable past of military coups, political violence and economic crisis.
Even before the failed military coup, the dream was clouded by spillover from the Syrian civil war - terrorism and a flood of refugees.
With so many threats now, even a clap of thunder sends people scampering for cover. People walking the streets are scrutinised for what they are wearing and what they are carrying. A backpack could be a bomb. A sweater or jacket in the summer could conceal a vest of explosives.
Nowadays, it seems, all of Turkey's old conflicts - most prominently the divide between religious and secular Turks - and many new ones, are coming to the fore.
NEW YORK TIMES