ANKARA, Turkey (TheBlaze/AP) -- Rather than toppling Turkey's strongman president, a failed military coup that left more than 250 dead appears to have bolstered Recep Tayyip Erdogan's immediate grip on power and boosted his popularity.
Tens of thousands marched through the streets in half a dozen Turkish cities late Saturday, waving flags and singing songs in an emotional outpouring of support for the long-time leader as security forces rounded up military personnel it branded coup supporters and launched a purge of judges seen as government opponents.
Prime Minister Binali Yildirim said the perpetrators of Friday's failed coup "will receive every punishment they deserve," and the government said it would take steps toward extraditing a U.S.-based cleric it accused of fomenting the uprising.
The government threat of further crackdowns raised concerns over the future of democracy in Turkey, which has long prided itself in its democratic and secular traditions despite being in a tumultuous region swept by conflict and extremism.
The coup attempt began late Friday with tanks rolling into the streets of the capital, Ankara, and Istanbul as Erdogan was enjoying a seaside 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 his supporters into the streets to confront the troops and tanks, and forces loyal to the government began reasserting control.
The unrest claimed at least 265 lives, according to a tally compiled from official statements. Yildirim said 161 people were killed and 1,440 wounded in the process of putting down the coup attempt. Turkey's acting chief of the general staff, Gen. Umit Dundar said at least 104 "coup plotters" had died.
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.
By Saturday afternoon, when tensioned eased, an atmosphere of celebration broke around as Turks answered official calls to rally in the squares to protect Turkish democracy. Thousands gathered in major cities singing and waving Turkish flags while others held prayers in support of Erdogan and chanted "God is great."
In Istanbul, crowds gathered at Taksim Square, where a man stood on an iconic monument with a Turkish flag draped on his chest.
Government supporters marched through Ankara as cars honked in apparent approval. Some gathered outside parliament and amid the burnt cars outside the presidential palace. One man took a selfie with a Turkish police officer standing atop an abandoned tank.
"We are here for democracy, so the country lasts," retired soldier Nusret Tuzak said at the Ankara gathering.
In an usual show of unity, Turkey's four main political parties released a joint declaration during an extraordinary parliamentary meeting Saturday, denouncing the coup attempt and claiming that any moves against the people or parliament will be met "with the iron will of the Turkish Grand National Assembly resisting them."
A Turkish man takes a selfie with a Turkish police officer, loyal to the government, as they stand atop tanks abandoned by Turkish army officers, against a backdrop of Istanbul's iconic Bosporus Bridge, Saturday, July 16, 2016. (AP Photo/Emrah Gurel)
Turkey's NATO allies lined up to condemn the coup attempt. President Barack Obama, German Chancellor Angela Merkel and NATO chief Jens Stoltenberg urged all sides to support Turkey's democratically elected government.
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.
Government forces arrested 2,839 accused coup supporters, Yildirim said. Dundar, the general, said the plotters were mainly officers from the Air Force, the military police and armored units.
Anadolu Agency said the government dismissed 2,745 judges across Turkey. Two constitutional court judges were also detained over their alleged role in the coup attempt, according to a Turkish official, who spoke on customary condition of anonymity.
Officials accused the judges and the coup plotters of being loyal to moderate 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. At a news conference in Saylorsburg, Pennsylvania, Gulen strongly denied any role in or knowledge of the coup.
Ankara recently classified his movement as a terrorist organization. Washington, however, has never found any evidence particularly compelling previously against the cleric.
Protesters gathered at the Turkish cleric's home on Saturday:
In a televised speech Saturday, Erdogan called on the United States to extradite Gulen, saying Turkey had never turned back any extradition request for "terrorists" by the United States. A Turkish official, speaking on condition of anonymity in line with government regulations, said Turkey was preparing a formal extradition application.
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."
Gulen himself condemned the coup.
"Government should be won through a process of free and fair elections, not force," he said. "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. I categorically deny such accusations."
Fadi Hakura, a Turkey expert at the Chatham House think tank in London, said the attempted coup appeared to have been "carried out by lower-ranking officers."
"Their main gripe seems to have been President Erdogan's attempt to transform his office into a powerful and centralized executive presidency," Hakura said. "In the short term, this failed coup plot will strengthen President Erdogan."
Turkey's military staged three coups between 1960 and 1980 and pressured Prime Minister Necmettin Erbakan, a pious mentor of Erdogan, out of power in 1997.
Turkey has allowed American jets to use its Incirlik air base to fly missions against the Islamic State group in neighboring Syria and Iraq. The Pentagon said U.S. warplanes stopped flying those missions from Incirlik after the Turkish government closed its airspace to military aircraft during the attempted coup. U.S. officials were working with Turkish officials to get permission to resume air operations as soon as possible.
Soguel reported from Istanbul. Emrah Gurel, Bram Janssen and Cinar Kiper in Istanbul, Mucahit Ceylan in Ankara and Jill Lawless in London also contributed.