ISTANBUL (AP) -- The Turkish government accelerated its crackdown on alleged plotters of the failed coup against President Recep Tayyip Erdogan, with the justice minister saying Sunday that 6,000 people had been detained in the investigation, including three of the country's top generals and hundreds of soldiers.
In addition to those mentioned by Justice Minister Bekir Bozdag, dozens of arrest warrants have been issued for judges and prosecutors deemed to be government opponents.
The government has also dismissed nearly 3,000 judges and prosecutors from their posts, while investigators were preparing court cases to send the conspirators to trial on charges of attempting to overthrow the government.
"The cleansing (operation) is continuing. Some 6,000 detentions have taken place. The number could surpass 6,000," Bozdag said in televised comments.
The botched coup, which saw warplanes fly over key government installations and tanks roll up in major cities, ended hours later when loyal government forces regained control of the military and civilians took to the streets in support of Erdogan.
Chanting, dancing and waving flags, tens of thousands of Turks marched through the streets into the early hours Sunday in half a dozen cities after officials urged them to defend democracy and back Erdogan, Turkey's top politician for 13 years.
It was an emotional display by Turks, who rallied in headscarves and long dresses, T-shirts and work boots, some walking hand-in-hand with their children. Rather than toppling him, the attempted coup that left some 265 dead and 1,440 wounded appears to have bolstered Erdogan's popularity and grip on power.
The Yeni Safak newspaper used the headline "Traitors of the country," while the Hurriyet newspaper declared "Democracy's victory."
"Just a small group from Turkish armed forces stood up against our government ... but we, the Turkish nation, stand together and repulse it back," Gozde Kurt, a 16-year-old student at the rally in Istanbul, said Sunday morning.
Gen. Umit Dunda said the dead included at least 104 conspirators, describing them as mainly officers from the Air Force, the military police and armored units.
Officials claimed the conspirators were loyal to moderate U.S.-based cleric Fethullah Gulen, whom Erdogan has often accused of attempting to overthrow the government. Gulen, a staunch democracy advocate who lives in exile in Pennsylvania, is a former Erdogan ally turned bitter foe who has been put on trial in absentia in Turkey. He strongly denies the charges.
Funeral ceremonies and prayers for those killed in the coup were held in Ankara and Istanbul on Sunday, where relatives beside themselves with grief. Prayers were read simultaneously from Turkey's 85,000 mosques at noon to honor those who died in an attempted military coup.
Sela prayers are traditionally recited from mosques during funerals, though they are also performed to rally people, as they were all night Friday during tense coup hours.
A government official said autopsies have been completed on 165 people, including 115 reclaimed by their families. He spoke on condition of anonymity in line with regulations.
Forty policemen, including twin brothers, were killed when the renegade soldiers attacked a special forces station in Ankara.
The victims also included Erdogan campaign manager Erol Olcak and his 16-year old son Abdullah, killed when renegade soldiers opened fire on protesters at the Bosporus bridge in Istanbul on Friday night.
Photojournalist Mustafa Cambaz also took to the streets, following calls by the president for people to oppose the coup attempt. Cambaz, who worked for the pro-government Yeni Safak newspaper, was killed by gunfire in Istanbul.
The elder brother of one of Erdogan's chief advisers was also killed in gunfire while protesting the coup in front of the Istanbul Municipality building. Ilhan Varank died during clashes that lasted five hours.
The wide reach of the government crackdown raised concerns over the future of democracy in Turkey, which has long prided itself on its democratic and secular traditions despite being in a tumultuous region swept by conflict and extremism.
Erdogan's survival has turned him into a "sort of a mythical figure" and could further erode democracy in Turkey, said Soner Cagaptay, director of the Turkish research program at The Washington Institute.
"It will allow him (Erdogan) to crack down on liberty and freedom of association, assembly, expression and media in ways that we haven't seen before and find strong public support within the country," he said.
Prime Minister Binali Yildirim said the perpetrators of Friday's failed coup "will receive every punishment they deserve."
Security forces on Sunday rounded up 52 more military officers for alleged coup links. The state news agency Anadolu said a detention order has been issued for 110 judges and prosecutors in Istanbul alone for their alleged involvement with the group reportedly responsible for the failed coup.
The suspects are being charged with "membership in an armed terrorist organization" and "attempting to overthrow the government of the Turkish Republic using force and violence or attempting to completely or partially hinder its function." The agency said 58 homes of prosecutors and judges have been searched.
Officials say 2,745 judges and prosecutors across the country have been dismissed.
The coup attempt began late Friday with tanks rolling into the streets of the capital, Ankara, and Istanbul as Erdogan was on vacation. Explosions and gunfire erupted throughout the night. It quickly became clear, however, that the military was not united in the effort to overthrow the government. In a dramatic iPhone interview broadcast on TV, Erdogan urged supporters into the streets to confront the troops and tanks, and forces loyal to the government began reasserting control.
In an unusual show of unity, Turkey's four main political parties released a joint declaration denouncing the coup attempt, as did Turkey's NATO allies, including President Barack Obama.
Before the weekend's chaos, Turkey — a NATO member and key Western ally in the fight against the Islamic State group — had been wracked by political turmoil that critics blamed on Erdogan's increasingly authoritarian rule. He has shaken up the government, cracked down on dissidents, restricted the news media and renewed fighting with Kurdish rebels.
Erdogan called on the United States to extradite Gulen but at a news conference Saturday in Saylorsburg, Pennsylvania, Gulen strongly denied any role in or knowledge of the coup.
"As someone who suffered under multiple military coups during the past five decades, it is especially insulting to be accused of having any link to such an attempt," he said.
U.S. Secretary of State John Kerry said the United States would entertain an extradition request for Gulen, but Turkey would have to present "legitimate evidence that withstands scrutiny."
Flights resumed late Saturday into Istanbul's Ataturk Airport after being halted for nearly 24 hours but Turkish Airlines said Sunday it had to cancel 196 flights because of a backlog of traffic.