Turkish President Recep Tayyip Erdogan has told a vast rally in Istanbul that he would approve the return of the death penalty if it was backed by parliament and the public.
He was speaking to a crowd of at least a million who had gathered in Turkey's biggest city.
The rally followed last month's failed military coup.
Mr Erdogan also said the state would be cleansed of all supporters of the US-based cleric Fethullah Gulen.
The cleric is blamed by the Turkish government for the attempted uprising. He denies any involvement.
Religious figures and leaders of two of Turkey's three opposition parties attended the rally. The Kurdish party was not invited.
More than 270 people died in events surrounding the 15 July coup attempt, which triggered a government crackdown.
Thousands of alleged supporters of Mr Gulen have been detained or dismissed from government jobs.
Western nations have been critical of the government's response to the coup. The European Union - which Turkey has applied to join - refuses to accept capital punishment in member states.
The parade ground, built to hold more than a million people, was overflowing, with streets of surrounding neighbourhoods clogged by crowds, Reuters news agency reports.
Turkish government sources said five million people had attended, with the event broadcast live on public screens at smaller rallies across Turkey's provinces.
Mr Erdogan told the rally: "It is the Turkish parliament that will decide on the death penalty... I declare it in advance, I will approve the decision made by the parliament.
"They say there is no death penalty in the EU... Well, the US has it; Japan has it; China has it; most of the world has it. So they are allowed to have it. We used to have it until 1984. Sovereignty belongs to the people, so if the people make this decision I am sure the political parties will comply."
The president railed against Mr Gulen's movement, hinting of further hardline measures to come.
"July 15 showed our friends that this country isn't just strong against political, economic and diplomatic attacks, but against military sabotage as well. It showed that it will not fall, it will not be derailed," Mr Erdogan said.
"Of course we have to uncover all members of this organisation and eradicate them within the framework of the law, but if we content ourselves with just that, then we as a state and a nation will leave weak our defence against similar viruses."
The "Democracy and Martyrs' Rally" was the climax of three weeks of nightly demonstrations by Mr Erdogan's supporters around the country.
Speaking ahead of Mr Erdogan, Prime Minister Binali Yildirim told the rally that Mr Gulen would be brought to Turkey and made to pay the price for the coup attempt.
"Let all of you know, the leader of this terrorist group will come to Turkey and pay for what he did," Mr Yildirim said.
In a rare address to a public rally, the head of Turkey's armed forces, Hulusi Akar, said "traitors" would be punished in the harshest way, and thanked civilians for their role in defeating the uprising.
The crackdown in Turkey has seen tens of thousands of public sector workers suspended or dismissed, with many having their passports cancelled. There has also been a massive reshuffle of the military.
About 18,000 people have been detained or arrested.
Local branches of the AK Party have been told to begin a purge of suspected Gulenists in their ranks.
Mr Gulen was a close ally of President Erdogan until a bitter split between his movement and the party of the president three years ago.
Turkey has listed Mr Gulen's movement as a terrorist organisation.