At about 11pm on Friday, I was passionately debating Pokémon Go at a dinner party in Istanbul when someone announced that a military coup was taking place. “Really – actual jets? Tanks at the airport – seriously?” Everyone was incredulous, scanning their phones, until someone spotted a helicopter from the balcony. Reality hit home, and we hastily took our leave. In corner shops middle-class locals were stocking up on water and – bizarrely – pet food.

In Taksim Square, finally, proof of the outrageous rumours: soldiers stood to attention around the perimeters of the square with police arrayed warily behind them. By the time I reached home the sound of gunfire was breaking out. At about 3am fighter jets were zooming over my apartment, shattering glass and sending me diving to the floor, while my local mosque called the faithful to the streets to protest against the coup. The night had escalated quickly.

In retrospect the attempted coup was a case of “blink and you’ll miss it”, but at the time it was a long night of confusion and violence as first the army and then police took control of TV stations, and social media buzzed with rumours. As dawn broke, President Recep Tayyip Erdoğan announced that the coup had failed. Mere hours after soldiers fired on civilians on the Bosphorus Bridge they had surrendered to police. Ferries and trams trundled back to life, and taxis drove people home, navigating broken glass and tanks abandoned on the road. Even at the airport, where terrified passengers had hidden from explosions and where the president made his dramatic address to the people after evading capture, business was returning to normal.

But as the dust clears, the scale of damage – both immediate and long term – has become clear: at least 290 people have died and many more are injured. Parliament has been bombed. More than 6,000 military and judiciary personnel thought to be linked to the coup have been arrested, and an already cowed media fear a similar purge. While Erdoğan’s supporters celebrate, many Turks are wondering: what the hell happened – and what next?

Exactly who orchestrated the coup remains unclear. And, as usual in Turkey, conspiracy theories abound. While the government points the finger at the Pennsylvania-based Islamic cleric Fetullah Gülen, whom Erdoğan accused of attempting to oust him with a corruption scandal in December 2013, others believe the president himself stage-managed it all to consolidate his power by quashing the military for good.

According to this theory, Erdoğan now has a cast-iron excuse for future authoritarianism, having established himself as the country’s undisputed guardian of popular rule – after all, the coup failed after his supporters responded to his call to take to the streets. I don’t share this view. A better theory is that Friday was a last-ditch attempt by factions of the army desperate to remove Erdoğan before he pushed forward plans to change the constitution to establish an executive presidency for himself, and – more urgently – to prevent the purge of army personnel that was probably in the works before this weekend.

What is interesting is the complete lack of public support for the attempt. Turkey has a long-established history of coups, which have occurred punctually almost every decade (1960, 1971, 1980 – plus 1997’s “postmodern” coup). Staunchly secular nationalists who like the idea of militarily safeguarding the country from ideological leaders may have been expected to support the coup. And yet there was no evidence of that, despite heartfelt opposition to Erdoğan’s 13-year rule among about 50% of the population, and growing desperation at the lack of mainstream opposition in Turkish politics.

Anyone who may have nominally supported the idea of an end to Erdoğan’s presidency melted away as news broke on Friday. In the middle-class, secular neighbourhood where I live, people watched the news at home, frightened and confused. There was no banging of pots at the windows, as happened during the popular Gezi Park protests of 2013, no excitement or sense of ownership over political change.

By contrast, the reaction of Erdoğan’s Justice and Development party (AKP) supporters was overwhelming. They risked life and limb to stand by their man. After he appeared live on FaceTime at about 4am on CNN Türk, calling them out on to the streets, they responded in their thousands, encouraged by the call of mosques across the major cities. A friend of mine had landed at Istanbul airport just as the coup was kicking off. He managed to crawl through passport control as armed soldiers held up thousands of passengers queuing in immigration, and made it to the arrivals hall, only to encounter furious crowds supportively chanting Erdoğan’s name and demanding to know where the soldiers were.

Whole families joined the fray, wives and children proudly wearing their AKP T-shirts and flags and fearlessly preparing to tackle armed soldiers. Later, on Saturday night, I saw them celebrating wildly in Taksim Square with flags and posters of the president, and sitting on the steps on Gezi Park, where anti-government protesters gathered just three years ago to demand an end to Erdoğan’s government. It would not surprise me if in years to come the park becomes a symbol not of protest but of the validation of Erdoğan’s rule. Friday’s events have comprehensively altered the narrative.

Erdoğan was not shy in demanding support, and this was the ultimate proof of his popularity – and, more broadly, of the Turkish will to resist the violent coups that have characterised past decades. And yet there was a sinister aspect to the reaction of the anti-coup crowds. Soldiers – many of whom were clueless teenage conscripts who apparently thought they were part of a training exercise – were rounded up, beaten, stripped and, according to some reports, lynched (one particularly distressing image of a beheaded soldier emerged on Saturday morning on social media). The reputation of Turkish soldiers - previously adored, almost sanctified in a fiercely nationalistic young republic - has been turned on its head.

We now have a situation where violent mobs are sanctioned as “protecting democracy” by the president, whose prestige and power is now cemented more firmly than ever. This coup was the equivalent of an unhappy wife being kidnapped by a misguided and incompetent lover – a botched coup-nap. She – the 50% of Turks who would like to see Erdoğan voted out of power – never asked for such a rescue. After all, a civilised divorce is one thing, but no one actually wants a return to such medieval methods as the coup of 1980.

This will never happen again, at least in Erdoğan’s time. The wife will be “safely” locked away, and the lover will be disposed of – perhaps humanely, perhaps not. After the quashed coup, as furious crowds demanded the return of the death penalty for captured soldiers, Prime Minister Binali Yıldırım assured them he “heard their message”. On Sunday Erdoğan added his own voice, saying: “We are not vengeful, but in democracies you cannot put the wishes of the people to one side.”

There is relief in Turkey that the coup failed and we are not living under military rule. But there is a dark side to the reality we have woken to, and a surreal quality to the wild jubilation erupting on Istanbul’s streets. Erdoğan has asked his supporters to continue their celebrations all week. What do the next few years hold?