For several hours on Friday night hundreds of Turkish soldiers appeared to have taken control of key areas of the main cities of Ankara and Istanbul.
There was little sign of President Recep Erdogan as the plotters took over buildings and media outlets. They needed to secure the support of the public and especially the majority of the military.
Prime Minister Binali Yildirim appeared to be leading resistance to the coup, but as most Turks know, it is President Erdogan who wields the power and has designs on extending it.
If the coup was going to succeed, the conspirators had to keep him out of the picture and they were unable to do so. “I am the chief commander,” he said later.
When the tide turned
For hours it was unclear where President Erdogan was. Reports said he was on holiday at the Aegean resort of Marmaris, deep in Turkey’s south-west.
The tide turned when the president flew into Istanbul’s Ataturk airport and gave a defiant news conference.
The moment he touched base in Istanbul it was clear the government was regaining control and had the support of senior military figures.
Ankara, where his palace and the government are based, was not yet secure, but in Istanbul he was able to address Turkey directly.