Forces loyal to the Turkish government fought on Saturday to crush the remnants of a military coup attempt which crumbled after crowds answered President Recep Tayyip Erdogan's call to take to the streets and dozens of rebels abandoned their tanks.

Turkish Prime Minister Binali Yildirim said 161 people had been killed and 1,440 wounded after a faction of the armed forces tried to seize power using tanks and attack helicopters. Some strafed the headquarters of Turkish intelligence and parliament in the capital, Ankara, and others seized a major bridge in Istanbul.

The death toll given by Yildirim was lower than a previous military-provided total of 194 people.

Erdogan accused the coup plotters of trying to kill him and launched a purge of the armed forces, which last used force to stage a successful coup more than 30 years ago.

"They will pay a heavy price for this," said Erdogan, who also saw off mass public protests against his rule three years

ago. "This uprising is a gift from God to us because this will be a reason to cleanse our army."

A Turkish broadcaster reported that a purge of the judiciary was also underway.

2,800 rounded up

One government minister said some military commanders were still being held hostage by the plotters. But the government declared the situation fully under control, saying 161 people had been killed and 2,839 had been rounded up from foot soldiers to senior officers, including those who had formed "the backbone" of the rebellion.

A successful overthrow of Erdogan, who has ruled the country of about 80 million people since 2003, would have marked one of the biggest shifts in the Middle East in years, transforming a major U.S. ally while war rages on its border.

However, a failed coup attempt could still destabilize a NATO member that lies between the European Union and the chaos of Syria, with Islamic State in Iraq and Syria (ISIS) bombers targeting Turkish cities and the government also at war with Kurdish separatists.

A policeman stands atop of a military armoured vehicle after troops involved in the coup surrendered on the Bosporus Bridge in Istanbul. (Murad Sezer/Reuters)

Erdogan, who had been holidaying on the southwest coast when the coup was launched, flew into Istanbul before dawn on Saturday and was shown on TV outside Ataturk Airport.

Addressing a crowd of thousands of flag-waving supporters at the airport later, Erdogan said the government remained at the helm, although disturbances continued in Ankara.

Erdogan says he was targeted

Erdogan, a polarizing figure whose Islamist-rooted ideology lies at odds with supporters of modern Turkey's secular

principles, said the plotters had tried to attack him in the resort town of Marmaris.

"They bombed places I had departed right after I was gone," he said. "They probably thought we were still there."

Supporters of Turkish President Recep Tayyip Erdogan celebrate after soldiers involved in the coup surrendered on the Bosporus Bridge in Istanbul. (Yagiz Karahan/Reuters)

Erdogan's AK Party has long had strained relations with the military, which has a history of mounting coups to defend

secularism although it has not seized power directly since 1980.

His conservative religious vision for Turkey's future has also alienated many ordinary citizens who accuse him of

authoritarianism. Police used heavy force in 2013 to suppress mass protest demanding more freedom.



However, he also commands the admiration and loyalty of millions of Turks, particularly for restoring order to an

economy once beset by regular crises. Living standards have risen steadily under his rule, and while the economy has hit serious problems in recent years, it grew a greater-than-expected 4.8 per cent year-on-year in the first quarter.



Still, the violence is likely to hit a tourism industry already suffering from the bombings and a row with Russia that

had appeared to have been settled, and business confidence is also vulnerable.

Video-calling address

In a night that sometimes verged on the bizarre, Erdogan took to social media even though he is an avowed enemy of the technology when his opponents use it, frequently targeting Twitter and Facebook.



Erdogan addressed the nation via a video-calling service, appearing on the smartphone of a CNN Turk reporter who held it up to a studio camera so viewers to the network could see him.

He said the "parallel structure" was behind the coup attempt — his shorthand for followers of Fethullah Gulen, a Muslim cleric whom he has repeatedly accused of trying to foment an uprising in the military, media and judiciary.

A man walks inside the destroyed parliament building in Ankara after the attempted coup. (Reuters)

Gulen, who lives in self-imposed exile in the United States, once supported Erdogan but became a nemesis. He denied accusations he played a role in the attempted coup and said he condemned in the strongest terms the action.



"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," Gulen said in a statement.

U.S. Secretary of State John Kerry said the United States had not received any request to extradite Gulen.

Judge purge

The purge appeared to go beyond the military. Citing a decision by the High Council of Judges and Prosecutors, broadcaster NTV reported that authorities had removed 2,745 judges from duty.

Gunfire and explosions had rocked both Istanbul and Ankara through the night after soldiers took up positions in both

cities and ordered state television to read out a statement declaring they had taken power. However, by dawn the noise of fighting had died down considerably.

About 50 soldiers involved in the coup surrendered on one of the bridges across the Bosporus Strait in Istanbul after dawn on Saturday, abandoning their tanks with their hands raised in the air. Reuters witnesses saw government supporters attack the pro-coup soldiers who had surrendered.

Turkish President Recep Tayyip Erdogan addresses the nation after landing in Istanbul several hours into the coup attempt. (Huseyin Aldemir/Reuters)

Earlier, around 30 pro-coup soldiers had surrendered their weapons after being surrounded by armed police in Istanbul's

central Taksim square.

They were taken away in police vans as a fighter jet repeatedly screeched overhead at low altitude, causing a boom

that shook surrounding buildings and shattered windows.

Neighbouring Greece arrested eight men aboard a Turkish military helicopter which landed in the northern city of

Alexandroupolis on Saturday, the country's police ministry said, adding that they had requested political asylum.

Bospurus re-opened

Turkish maritime authorities reopened the Bosporus to transiting tankers after shutting the major trade route from the

Black Sea to the Aegean for several hours for security and safety reasons.

Turkish police arrest Turkish soldiers at the Taksim Square in Istanbul early Saturday. The country's president and prime minister said that the Turkish military was involved in an attempted coup d'etat. (Tolga Bozoglu/EPA)

The Turkish Embassy in Ottawa said the coup was "foiled by the Turkish people in unity and solidarity." It said not all the Turkish armed forces were behind the move.

"It was conducted by a clique within the Armed Forces and received a well-deserved response from our nation," the statement said.

Dion 'very concerned'

Canadian Foreign Affairs Minister Stéphane Dion said on Twitter he is "very concerned about reports from Turkey."

Global Affairs Canada also went on Twitter to offer assistance to Canadians who may be trapped in the country, telling them to call 90 (312) 409-2700 or to email sos@international.gc.ca.

U.S. Secretary of State John Kerry said he phoned the Turkish foreign minister and underlined "absolute support for

Turkey's democratically elected, civilian government and democratic institutions".