REUTERS/ GETTY A mob beheaded a rebel soldier in Istanbul

FREE now and never miss the top politics stories again. SUBSCRIBE Invalid email Sign up fornow and never miss the top politics stories again. We will use your email address only for sending you newsletters. Please see our Privacy Notice for details of your data protection rights.

Graphic pictures being circulated on social media show a soldier being beheaded as a mob surrounds his bloodied body. The pictures show the corpse on one of the bridges crossing the Bosphorus river in Istanbul. He was allegedly beaten by supporters of the ruling Justice and Development Party (AKP).

A graphic video shows a crowd surrounding his body as his head lies on the ground. At least 265 people, including civilians, were killed as a faction of Turkish troops attempted to overthrow President Recep Tayyip Erdogan’s government. The coup failed after crowds of government supporters answered President Erdogan's call to take to the streets and dozens of rebels abandoned their tanks.

REUTERS Surrendered Turkish soldiers who were involved in the coup are beaten on Bosphorus bridge

REUTERS Crowds gather for celebration in Istanbul

They will pay a heavy price for this. This uprising is a gift from God to us because this will be a reason to cleanse our army. President Erdogan

A faction of the armed forces tried to seize power using tanks and attack helicopters targeting the Turkish parliament and intelligence headquarters in the capital, Ankara. Mr 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. He said: "They will pay a heavy price for this. This uprising is a gift from God to us because this will be a reason to cleanse our army."

Nearly 3,000 plotters have been rounded up by the government from foot soldiers to senior officers, including those who had formed "the backbone" of the rebellion. Mr Erdogan, who had been holidaying on the southwest coast when the coup was launched, flew into Istanbul before dawn today and was shown on television outside Ataturk Airport. Addressing thousands of flag-waving supporters at the airport later, he said the government remained at the helm, although disturbances continued in Ankara.

REUTERS President Erdogan flew into Istanbul at dawn

GETTY A Turkish police officer stands guard by an abandoned tank

GETTY Crowds gather on Bosphorus bridge

EPA Erdogan supporters cheer at Ataturk Airport

Mr Erdogan, a polarising figure whose Islamist-rooted ideology lies at odds with supporters of modern Turkey's secular principles, said the plotters tried to attack him in the resort town of Marmaris. He said: "They bombed places I had departed right after I was gone. They probably thought we were still there." Mr Erdogan's AKP 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.

Gunfire and explosions 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. About 50 soldiers involved in the coup surrendered on one of the bridges across the Bosphorus Strait in Istanbul after dawn , abandoning their tanks with their hands raised in the air. Eyewitnesses saw government supporters attack the pro-coup soldiers who had surrendered.

A look back on the shocking Turkish military coup that left 294 dead Wed, July 27, 2016 The violent military coup to overthrow Turkey's President Erdogan has 'failed' leaving at least 104 dead and more than 1,500 wounded Play slideshow Getty Images 1 of 42 A police officer talks with the soldiers involved in the coup attempt after they surrendered