Following hours of uncertainty, Turkey's government crushed an attempted coup by elements within the military, with the failure strikingly evident just after dawn as television stations broadcast soldiers on Istanbul's bridges surrendering.
Government officials stressed that fighting the coup was about preserving democracy and not about saving President Recep Tayyip Erdogan.
Now the president has come out swinging, vowing that those involved in the plot "will pay a heavy price for their treason."
Government officials said 104 pro-coup soldiers were among the 265 killed. The government has so far detained 2,839 military personnel, with the number of arrests expected to rise, according to Prime Minister Binali Yildirim.
Turkey's top judicial body also dismissed 2,745 judges on Saturday and ten board members were dismissed due to detention orders from a prosecutor, according to state news agency Anadolu.
The president has recently been focusing his efforts on trying to change the constitution to consolidate his power by empowering his office, in a move critics say will weaken checks and balances and parliament's role.
His next moves will be closely watched in the days and weeks ahead.
Howard Eissenstat, associate professor of Middle East History at St Lawrence University in the US, bluntly called the coup "dumb" and noted the president's "repressive instincts."
It was unclear who exactly was behind the attempt. No coup leader emerged, its only presence was a vague statement, lacking a clear ideology, which read out on the state broadcaster, and a request for curfew.
There appeared to be multiple misjudgments on the part of the coup plotters, who managed to unite Turkey's fractious political spectrum against what appears to have been a poorly planned and somewhat clumsy attempt to seize power.
From leftist Kurds to Islamists and right-wing Turkish nationalists, all four parties in Parliament rejected the putsch, with many politicians stressing that past years of military rule were a disaster.
"Opposition parties came out against the coup when it wasn't clear which way it was going to go," Selim Koru, an Ankara-based analyst, said on his Twitter account.
US Secretary of State John Kerry was quoted by NBC saying that the coup "does not appear to be brilliantly planned or executed.
"We stand by the democratically elected leader and leadership."
But there were also calls for restraint.
"Rule of law, democracy, respect for human rights and freedom of the media must be upheld even in difficult times," OSCE Secretary General Lamberto Zannier said.
Erdogan is seen as a polarizing figure, who is either loved or strongly disliked, though he manages to maintain a majority and win elections.
There was little support among Turks for the military revolt.
"I have only vaguest guesses as to motivation or profile of coup leaders," said Eissenstat.
"Clear, however, they were both desperate and politically clueless," he posted on Twitter, noting the "near universal condemnation within Turkey."
Meanwhile, the president was photographed by Anadolu on Saturday meeting and greeting supporters who had taken to the streets of Istanbul, lining the sides of major roads and holding the red and white Turkish flag in support of the civilian government.