Tens of thousands of people have joined a pro-democracy rally in Istanbul, condemning the nation's attempted coup.
The rally was organised by Turkey's opposition party CHP but was backed by President Recep Tayyip Erdogan's AK party, in a rare show of unity.
Amid a sea of red flags, banners bore slogans such as "We defend the republic!"
CHP Kemal Kilicdaroglu leader said "democracy won!" but he also warned against the dangers of authoritarianism.
One banner read: "No to the coup, no to dictatorship".
'Turkey stood proudly'
Many of the CHP supporters gathered in Taksim Square waved flags with a picture of Mustafa Kemal Ataturk, the founder of modern Turkey.
Posters at the rally proclaimed "No to coups".
In his speech, the CHP's Kemal Kilicdaroglu said that amid the turmoil, "the parliament stood proudly, Turkey stood proudly, MPs stood proudly, people in this square have stood proudly, and democracy won!"
But he also stressed the importance of a free press and freedom of assembly, as well as the dangers of dictatorship and authoritarianism.
"The state cannot be governed by grudge, anger and prejudice. Those responsible for the coup should be tried lawfully, with the understanding of abiding by the rule of law," Mr Kilicdaroglu said.
In a rare move, pro-government television channels broadcast the speech live.
President Erdogan launched a widespread crackdown following the attempted coup, arresting thousands of service personnel and sacking or suspending thousands of judges, government officials, school teachers and university heads.
Human Rights group Amnesty International said it had received credible evidence of detainees being subjected to beatings and torture, including rape, since the coup attempt.
"It is absolutely imperative that the Turkish authorities halt these abhorrent practices and allow international monitors to visit all these detainees in the places they are being held," said Amnesty's Europe director John Dalhuisen in a statement.
A state of emergency was declared on Wednesday, allowing the president and cabinet to bypass parliament when drafting new laws and to restrict or suspend rights and freedoms.
Mr Erdogan has also extended the period in which suspects can be detained without charge to 30 days.
Ankara's chief prosecutor Harun Kodalak has been reported by Turkish media as saying that 1200 soldiers detained in the wake of the coup have now been released.
Those freed were said to be low-ranking soldiers. Thousands of other service personnel, including more than 100 generals and admirals, remain in detention.
On Saturday, Turkey's elite presidential guard was disbanded after nearly 300 of its members were detained following the failed coup.