UPDATED 11.34AM: Turkish authorities have rounded up nearly 3000 suspected military plotters and ordered thousands of judges detained after thwarting a coup by rebels using tanks and attack helicopters to try to topple President Tayyip Erdogan.
For several hours overnight on Friday violence shook Turkey's two main cities, as the armed faction which tried to seize power blocked a bridge in Istanbul and strafed the headquarters of Turkish intelligence and parliament in Ankara.
At least 265 people were killed.
An official said 161 of them were mostly civilians and police officers, while the remaining 104 were coup supporters.
But the coup attempt crumbled as Erdogan rushed back to Istanbul from a Mediterranean holiday and urged people to take to the streets to support his government against plotters he accused of trying to kill him.
"They will pay a heavy price for this," said Erdogan, launching a purge of the armed forces, which last used force to stage a successful coup more than 30 years ago.
"This uprising is a gift from God to us because this will be a reason to cleanse our army."
Among those detained were top military commanders, including the head of the Second Army which protects the country's borders with Syria, Iraq and Iran, state-run Anadolu news agency said.
Hundreds of soldiers were held in Ankara for alleged involvement in the coup, leaving police stations overflowing.
The government declared the situation under control, saying 2839 people had been rounded up, from foot soldiers to senior officers, including those who formed "the backbone" of the rebellion.
Authorities also began a major crackdown in the judiciary over suspected links to US-based cleric Fethullah Gulen, removing from their posts and ordering the detention of nearly 3000 prosecutors and judges, including from top courts.
Erdogan has blamed the coup on supporters of Gulen, who he has frequently accused of trying to foment uprising in the military, media and judiciary.
Ten members of the High Council of Judges and Prosecutors and two members of the Constitutional Court have already been detained, officials said.
US-based cleric Gulen said on Saturday the attempted overthrow may have been staged, and he urged the Turkish people not to view military intervention in a positive light.
"There is a slight chance, there is a possibility that it could be a staged coup," Gulen told reporters through a translator in Pennsylvania, where he resides.
Gulen said democracy cannot be achieved through military action. He criticised Erdogan's government.
"It appears that they have no tolerance for any movement, any group, any organisation that is not under their total control," he said.
Erdogan has urged Washington to deport Gulen.
Secretary of State John Kerry said the United States had not received any request to extradite Gulen.
US President Barack Obama expressed support for Turkey's government and called on all sides to avoid action that would lead to further violence or instability.
French President Francois Hollande said he expected a period of repression in the aftermath of the failed coup.
When parliament convened on Saturday, the four main political parties -- running the gamut from Erdogan's right-wing Islamist-rooted AK Party to the left-of-centre, pro-Kurdish Peoples' Democratic Party (HDP) -- came together in a rare show of unity to condemn the attempted coup.
Take your Radio, Podcasts and Music with you