In the age of the smartphone, the coup attempt in Turkey perhaps didn't stand a chance.
As speculation swirled on social media, a group of mutinous troops took over the state-run TRT station - not a particularly popular network - and forced an anchor to read on air a statement drafted by them about the apparent power grab.
Other military units had massed at major bridges and public buildings in Istanbul, Turkey's biggest city, and Ankara, the nation's capital.
The move smacked of a distinctly 20th-century operation, where uniformed men with guns could swiftly seize control of the machinery of state, starting with the media.
But President Recep Tayyip Erdogan, an entrenched and powerful leader, still had the upper hand.
He issued a message via Facetime, broadcast by a private TV network, urging the Turkish public to rally to his cause.
Mass text messages were sent out to countless people across the country. As a result, the haunting call to prayer rang out from Istanbul mosques in the dead of night at a time when nobody prays.
The country was activated and on the streets. The coup-makers were soon isolated and cornered.
Much remains uncertain about the chaotic events, including the origins of the plot against the Government.
But it seems the coup was ill-executed from the beginning, starting with the delivery of its message.
All the opposition parties in Turkey's Parliament, despite their loathing of Erdogan, rallied to the cause of the elected government and civilian rule.
Most of the main branches of the military and security services remained in Erdogan's camp.
Now, the crackdown has commenced. Nearly 3000 military personnel have been arrested, according to a statement from the prime minister. Senior officials, including Prime Minister Binali Yildirim, say the "putsch" was led by a clique within the military outside the chain of command.
"The situation is completely under control," Yildirim said. "Our commanders are in charge."
Sources in the Turkish president's office point to the secretive Gulen movement, led by an aging Islamic cleric who lives in Pennsylvania, the United States, as the main perpetrator.
They claim that the leading military officers involved knew they would be sidelined by a purge of Gulenists in the ranks in the coming weeks and had to act fast. The Gulenists have vociferously denied involvement.
What happens next is unclear, but experts are concerned that Turkey's already troubled democracy is in for a rocky ride.
"There was no good outcome," said Soner Cagaptay of the Washington Institute for Near East Policy. "If the coup had won, the state will be oppressive. [Now], it will still be oppressive, because now there'll be a witch hunt."
As Erdogan's critics point out, the Turkish leader and his allies in the ruling Justice and Development Party, or the AKP, have presided over a grim consolidation of power in recent years that has seen journalists arrested, critical newspapers and TV stations closed or taken over, social media censored and opposition politicians stripped of their legal immunity from prosecution.
"Erdogan will most certainly weaponise this coup attempt," says Burak Kadercan, a political scientist at the US Naval War College, subdue more of his opponents and move toward building the "absolute presidency" he has long sought. Kadercan expects "a further deterioration of Turkish democracy or whatever is left it".
The Turkish leadership, though, sees the failure of the coup as a victory for patriots in a country with a long, turbulent history of military interventions. Erdogan has routinely cast himself as the vulnerable democrat battling the machinations of the deep state - including coup-plotters who would reject the democratic will of the people.
"Every one of them was a tank man," Kilic Kanat wrote in the pro-government Daily Sabah, likening the coup protesters to the democracy activists at Tiananmen Square in 1989. "And every one of them acted responsibly and with courage. They showed the extent of civilian power."
Yet the AKP is by far the dominant force in Turkey and has tremendous control over state institutions, from the judiciary to the civil bureaucracy. Earlier investigations and trials of suspected military coup-plotters had brought the army to heel, despite the ideological differences between the staunchly secular top brass and Erdogan's Islam-influenced nationalist party.
In Turkey's deeply polarised political landscape, conspiracy theories whirled around Twitter that the coup was in fact an attempt by Erdogan to further expand his control
SHARE THIS QUOTE:
The atmosphere of conspiracy and threat cultivated by Erdogan and the AKP had its political uses, and informed much of their campaigning ahead of two parliamentary elections last year. Its logic - presented to the party's religiously conservative base - seems to have been borne out.
"There was this theory they presented that opposing the AKP meant supporting coups," Cagaptay said. "Now that theory has legs."
In Turkey's deeply polarised political landscape, conspiracy theories whirled around Twitter that the coup was in fact an attempt by Erdogan to further expand his control.
Some on social media thought the history-minded leader would see his arrival in Istanbul as akin to that of the victorious Ottoman sultan Mehmed the conqueror.
Others are more skeptical. "They were scared," Kadercan said of the government. "They literally almost begged people to take it to the streets."
The end result, though, may be very much in the Government's favour.