It was a strangely 20th century coup,defeated by 21st century technology and people power.
When a self-styled military "Peace Council" tried to topple Turkish President Tayyip Erdogan and his increasingly authoritarian government on Friday night, the rebel generals and colonels seemed to be fighting the last war.
"This coup was obviously planned quite well but using a playbook from the 1970s," said Gareth Jenkins, a researcher and writer on military affairs based in Istanbul.
It was more like Chile in 1973, or Ankara in 1980 than a modern Western state in 2016.
The rebels struck on a weekend when the president was out of town at a holiday resort. They seized the main airport, sealed off a bridge over the Bosphorus in Istanbul, sent tanks to parliament and Ankara and to control the main road junctions, and broadcast a statement on TRT state television declaring a curfew and warning people to stay at home.
But they failed to capture any of the ruling AK Party leaders or to shut down private television, mobile phone signals or social media networks, enabling Erdogan and his aides swiftly to call supporters into the streets to resist the coup.
Their biggest handicap, said Turkish analyst Sinan Ulgen of the Carnegie Europe think tank, was that they acted outside the military chain of command and hence lacked sufficient resources to take control of key levers of power.
"Their blueprint was also ineffective since they failed from the outset to capture any military installations in Turkey or any of the (political) leadership," said Ulgen, a former Turkish diplomat.
Erdogan, frequently accused of interfering with social media and muzzling the press and broadcasters, used modern communications technology nimbly to get his message out to the population of nearly 80 million, outflanking the plotters.
He used the FaceTime video application on a reporter's smartphone to broadcast a message live on CNN Turk, a private TV station which the plotters tried but failed to silence.
"Let's gather as a nation in the squares," he said. "I believe we will remove this occupation that has taken place within a short time. I am calling on our people now to come to the arenas and we will give them the necessary answer."
The president said rebels tried to bomb his hotel in the southwestern resort of Marmaris. There was also a gunfight there between soldiers and pro-government police after he had left.
Within 20 minutes of the coup broadcast, Prime Minister Binali Yildirim went on Twitter to denounce the putsch and assure Turks that the armed forces' high command was not backing the revolt.
They were following in a long line of revolutionaries who used new communications techniques to outwit their enemies -- from Protestant priest
Martin Luther using the printing press in 1517 to spread his theses denouncing the Roman Catholic church, to Ayatollah Ruhollah Khomeini recording audio cassettes in France that were copied and spread around Iran to defeat the Shah in 1979.