Turkey will continue fighting whatever powers seek to undermine the government, President Recep Tayyip Erdogan vowed on Sunday as he addressed a massive flag-waving rally in Istanbul in the wake of the country's abortive July 15 coup.
The Yenikapi meeting area by the Marmara Sea waterfront on Istanbul's European side was transformed into a sea of red and white, the colours of Turkey's flag. No official crowd figure was provided, but Turkish media said millions attended. The event was so full that large crowds were turned away at the gates, spilling into surrounding streets.
"As a state and as a nation we need to analyse the July 15 coup attempt very well. We need to evaluate well not just those who engaged in this treachery, but the powers behind them, the motives that made them take action," Mr Erdogan told the cheering crowd.
He spoke from a 60-metre (200-foot) stage framed by two platforms and draped with massive national flags and banners depicting Mr Erdogan and Turkey's founding father Mustafa Kemal Ataturk.
The Democracy and Martyrs' Rally was billed as a cross-party event representing Turkish unity in the wake of the failed coup, in which a group of renegade military officers attempted to seize power with tanks, helicopters and fighter jets, leaving more than 270 people dead.
"We will continue on our road in solidarity. We will love each other not for rank or title, but for Allah," Mr Erdogan said.
Religious leaders and two of Turkey's three opposition parties attended the rally, sitting next to Mr Erdogan, who arrived on board a helicopter with his wife Emine. The pro-Kurdish People's Democracy Party, or HDP, was not invited.
"July 15 has opened the door for our reconciliation," said main opposition Republican People's Party chairman Kemal Kilicdaroglu.
"There is now a new Turkey after July 15. If we can further this power, this culture of rapprochement, we will all be able to leave our children a great Turkey."
The government launched a sweeping crackdown in the coup's aftermath, targeting followers of US-based Muslim cleric Fethullah Gulen, who it says orchestrated the putsch. Mr Gulen denies involvement.
Nearly 18,000 people have been detained or arrested, mostly from the military, and tens of thousands of people have been suspended or dismissed from jobs in the judiciary, media, education, health care, military and local government.
"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.
"Those wringing their hands on that night hoping for Turkey to fall woke up the next day to realise their work was much harder than they thought."
The scope of the crackdown has alarmed European countries and rights groups, who have urged restraint. Mr Erdogan has lashed out at criticism, and complained of a lack of support from the West.
He has also demanded Mr Gulen's extradition from the US. Washington has said it would need evidence of the cleric's involvement, and says the extradition process must be allowed to take its course.
Mr Gulen's followers "are simply the visible tools of the threat against our country. We know that this game, this scenario is far beyond their league", 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."
Mr Erdogan reiterated he would approve the reintroduction of capital punishment if parliament were to pass a bill to that effect. The death penalty was abolished in Turkey in 2004, 20 years after the last execution. European Union officials have said a reintroduction of capital punishment would put an end to Turkey's prospects of joining the bloc.
The event kicked off with a minute of silence for those killed while opposing the coup, followed by the Turkish national anthem and a recitation of prayers.
"I have never been in democracy rallies but I really wanted to come this one. Because I don't want to lose my country," said Sevda Bozkurt, a 44-year-old housewife who did not manage to get in.
"This is one of the biggest rallies. Turkey's three political parties gathered together, they become friends, they become brothers. Maybe there is hope for Turkey."
Construction cranes suspended giant Turkish flags beside the meeting area, while flag-draped boats and yachts zipped back and forth along the water.
The government has been encouraging nightly anti-coup rallies in all of the country's 81 provinces since July 15. Sunday's rally was to have been the last, but Mr Erdogan said the end would be on Wednesday. He did not elaborate.
The event was broadcast live on giant screens in all of Turkey's provinces, and crowds of thousands gathered to watch in the country's major cities.
"Today is a special day, which is making all of the gatherings held for 15, 24 days, more precious," said Mustafa Yavuz Aycil, a 44-year-old Istanbul resident attending the rally.
"I also had to be here today because as you see all of the crowd is showing its reaction to the coup."
Nearly 15,000 police were providing security at the event. Anti-aircraft batteries were also set up at the event grounds, while two helicopters circled overhead.
Thousands of buses and more than 200 boats were commissioned to bring people to the area, where they passed through one of 165 metal detectors before being given hats and flags. Those wounded during the attempted coup and the families of those who died were given special passes for a seated area.
An Ottoman marching band entertained the gathering crowd, with 240 members representing the number of those authorities say gave their lives fighting off the coup.