Turkish authorities said they had regained control of the country on Saturday after thwarting an attempt by discontented soldiers to seize power from President Recep Tayyip Erdogan that claimed more than 250 lives.
After the bloodiest challenge to his 13-year autocratic rule, Erdogan urged his backers to stay on the streets to prevent a possible "flare-up" of Friday's chaos in the strategic NATO member of 80 million people.
With at least 2,839 soldiers already detained in a relentless round-up over the coup plot, the authorities blamed the conspiracy on Erdogan's arch enemy, the US-based cleric Fethullah Gulen.
"The situation is completely under control," Prime Minister Binali Yildirim said outside his Ankara offices, flanked by Turkey's top general who had himself been taken hostage by the plotters.
Describing the attempted coup as a "black stain" on Turkey's democracy, Yildirim said 161 people had been killed in the night of violence and 1,440 wounded.
This toll did not appear to include 104 rebel soldiers killed overnight, bringing the overall death toll from the bloodshed to 265.
During a night where power was in the balance, large crowds of flag-waving supporters of Erdogan's ruling Justice and Development Party (AKP) defied orders of a curfew and marching out onto the streets to block the attempt to overthrow the regime.
And Erdogan used his Twitter feed to urge people onto the streets to ensure no further challenges to his power.
"We should keep on owning the streets tonight no matter at what stage (the coup attempt is) because a new flare-up could take place at any moment," he said.
As the dust settled on a dramatic and chaotic night, TV pictures Saturday showed extensive damage to the parliament building in Ankara that was bombed by rebel jets.
- 'People are afraid' -
Friday's putsch bid began with rebel F-16 jets screaming low over rooftops in Ankara, soldiers and tanks taking to the streets and multiple explosions throughout the night in the capital as well as the biggest city Istanbul.
Rebel troops also moved to block the two bridges across the Bosphorus Strait in Istanbul, culminating in a stand-off with an angry crowd.
As protesters poured onto the streets, an AFP photographer saw troops open fire on people gathered near one of the bridges, leaving dozens wounded.
Soldiers also shot at protesters angrily denouncing the coup bid at Istanbul's Taksim Square, injuring several.
There was chaos in Istanbul as angry crowds jeered the passing tanks, with smaller numbers welcoming the troops.
"The people are afraid of a military government," a 38-year-old man who gave his name as Dogan told AFP. "Most of them have been in military service, they know what a military government would mean."
Turkish army F-16s launched air strikes against tanks stationed by coup backers outside the presidential palace in Ankara. Regular explosions could be heard from the AFP office situated near the complex.
As the popular tide turned against them, dozens of soldiers backing the coup surrendered on the Bosphorus bridge in Istanbul they had held throughout the night, holding their hands above their heads as they were detained, television pictures showed.
- 'Treason and rebellion' -
Erdogan denounced the coup attempt as "treachery", saying he was carrying out his functions and would keep on working "to the end".
"What is being perpetrated is a treason and a rebellion. They will pay a heavy price for this act of treason," Erdogan said. "We will not leave our country to occupiers."
The president's critics have long accused him of undermining modern Turkey's secular roots and of sliding into authoritarianism -- but he was believed to have won control of the military after purging elements who opposed him.
Turkey's once-powerful military has long considered itself the guardian of the secular state founded by Mustafa Kemal Ataturk in 1923.
It has staged three coups since 1960 and forced out an Islamic government in 1997.
Erdogan immediately pinned the blame on "the parallel state" and "Pennsylvania" -- a reference to Pennsylvania-based cleric Fethullah Gulen, his arch-enemy whom he has always accused of seeking to overthrow him.
But the president's former ally "categorically" denied any involvement in the plot, calling the accusation "insulting".
Yildirim took aim at the United States for hosting what he called "the leader of a terrorist organisation."
"Whichever country is behind him is not a friend of Turkey and in a serious war against Turkey," he added.
Meanwhile, Turkey demanded the extradition of eight people thought to have been involved in the putsch who landed in a Black Hawk military helicopter in Greece.
And Istanbul authorities sought to get life back to normal with the bridges reopening to traffic and Ataturk International Airport -- which had been shut down by the plotters -- gradually reopening.
- World leaders concerned -
The attempted coup brought new instability to the Middle East region, with Turkey a key powerbroker in the ongoing Syria conflict.
And world leaders appealed for calm, with US President Barack Obama and other Western countries urging support for the government they said had been democratically elected.
NATO chief Jens Stoltenberg welcomed what he called the "strong support shown by the people and all political parties to democracy and to the democratically elected government of Turkey," a key member of the alliance.
EU foreign policy chief Federica Mogherini called for "restraint and respect for democratic institutions," while Moscow said it was "deeply concerned" by the developments, which it warned would increase the threat to regional stability.
"Everything must be done to protect human lives," said a spokesman for German Chancellor Angela Merkel, while French Foreign Minister Jean-Marc Ayrault said he hoped Turkish democracy will "emerge stronger."