The Turkish government has cancelled the passports of around 50,000 people to prevent them leaving the country as a crackdown continues following a failed coup.

Efkan Ala, the interior minister, said more than 18,000 have so far been detained over the attempt to oust President Tayyip Erdogan, while thousands of government staff are under investigation.

The purges have provoked alarm in the international community, presenting a major stumbling block for Turkey’s campaign to join the European Union.

Turkey shakes up security forces after coup attempt

Amid calls for restraint from the US and European allies, hundreds of listed conscripts were released from detention and Mr Erdogan announced he was dropping prosecutions against around 2,000 people alleged to have “insulted him”.

Military school students were reportedly among 758 out of 989 conscripts released at the request of the Istanbul Chief Public Prosecutor after a court ruled that they did not pose a flight risk.

Mr Erdogan’s government is using powers under Turkey’s state of emergency to conduct a wide-ranging crackdown on alleged supporters of the exiled Muslim cleric Fetullah Gulen, who lives in the US.

Authorities say the failed coup on 15 July was staged by a military faction loyal to the Gulen or “Hismet” movement, but it has denied involvement.

Hundreds of soldiers armed with fighter jets, helicopters and tanks took control of key areas of the capital while Mr Erdogan was on holiday but were defeated after the President flew into Istanbul to make a defiant speech against an “act of treason and rebellion”.

Western governments and human rights groups have condemned the coup attempt, in which at least 246 people were killed and more than 2,000 injured, and also expressed concern over the extent of the crackdown tightening Mr Erdogan’s grip on power.

On Friday he condemned world leaders for their response, accusing them of showing more concern for coup supporters than the fate of Turkish democracy.

Dismissing criticism of the arrest, removal and suspension of more than 60,000 soldiers, journalists, academics and public sector workers, Mr Erdogan told supporters: “The attitude of many countries and their officials over the coup attempt in Turkey is shameful in the name of democracy.

In pictures: Turkey coup attempt Show all 17 1 /17 In pictures: Turkey coup attempt In pictures: Turkey coup attempt Turkish President Erdogan attends the funeral service for victims of the thwarted coup in Istanbul at Fatih mosque on July 17, 2016 in Istanbul, Turkey Burak Kara/Getty Images In pictures: Turkey coup attempt Soldiers involved in the coup attempt surrender on Bosphorus bridge with their hands raised in Istanbul on 16 July, 2016 Gokhan Tan/Getty In pictures: Turkey coup attempt A civilian beats a soldier after troops involved in the coup surrendered on the Bosphorus Bridge in Istanbul, Turkey, 16 July, 2016 REUTERS/Murad Sezer In pictures: Turkey coup attempt Surrendered Turkish soldiers who were involved in the coup are beaten by a civilian Reuters In pictures: Turkey coup attempt Soliders involved in the coup attempt surrender on Bosphorus bridge Getty In pictures: Turkey coup attempt Supporters of Turkish President Recep Tayyip Erdogan wave flags as they capture a Turkish Army vehicle Getty In pictures: Turkey coup attempt People pose near a tank after troops involved in the coup surrendered on the Bosphorus Bridge in Istanbul, Turkey, 16 July, 2016 Reuters In pictures: Turkey coup attempt Turkish soldiers block Istanbul's Bosphorus Brigde Getty In pictures: Turkey coup attempt A Turkish military stands guard near the Taksim Square in Istanbul Reuters In pictures: Turkey coup attempt Pierre Crom/Twitter In pictures: Turkey coup attempt Turkish soldiers secure the area as supporters of Recep Tayyip Erdogan protest in Istanbul's Taksim square AP In pictures: Turkey coup attempt People demonstrate in front of the Republic Monument at the Taksim Square in Istanbul Murad Sezer/Reuters In pictures: Turkey coup attempt Turkish soldiers detain police officers during a security shutdown of the Bosphorus Bridge Reuters In pictures: Turkey coup attempt Turkish Army armoured personnel carriers in the main streets of Istanbul Getty In pictures: Turkey coup attempt Chaos reigned in Istanbul as tanks drove through the streets EPA/TOLGA BOZOGLU In pictures: Turkey coup attempt Turkish President Tayyip Erdogan speaks to media in the resort town of Marmaris Reuters In pictures: Turkey coup attempt Supporters of President Erdogan celebrate in Ankara following the suppression of the attempted coup Reuters

"Any country and any leader who does not worry about the life of Turkish people and our democracy as much as they worry about the fate of coupists are not our friends.”

Mr Erdogan also criticised the European Council and the European Union, which Turkey aspires to be a part of, for their failure to pay a visit to offer condolences, saying their criticism was “shameful”.

The Director of US National Intelligence, James Clapper, said the purges were hampering the fight against Isis by sweeping away Turkish officers who had worked closely with international partners.

General Joseph Votel, head of US Central Command, said he believed some of the military figures the international coalition worked with had been jailed.

American authorities have been forced to deny they had any involvement in the coup attempt or prior knowledge, amid anger in Ankara for refusing to extradite Gulen without evidence.

Richard Moore, the British ambassador to Turkey, told the Hürriyet Daily News allegations that Britain backed the movement were equally as “silly”.

People kick and beat a Turkish soldier, who participated in the attempted coup, on Istanbul's Bosphorus Bridge (AP)

In the wake of the dishonourable discharge of almost 1,700 personnel, the Turkish armed forces are undergoing a major restructure seeing 99 colonels promoted to the rank of general and admiral after 40 per cent of top-ranking officers were dismissed.

The purges have also hit government ministries, schools and universities, the police, civil service, media and business.

Amnesty International said Turkey’s crackdown on civil society and media freedoms had “reached disturbing levels” after arrest warrants were issued for 89 journalists and 131 media outlets were closed.

It has also received reports of the widespread ill-treatment and torture of detainees under a lengthened pre-charge detention period of 30 days.

“Rounding up journalists and shutting down media houses is the latest assault on a media already weakened by years of government repression,” said Fotis Filippou, Deputy Europe Director at Amnesty International.

“Even under a state of emergency, restrictions must be necessary, proportionate and for a legitimate purpose. The provisions of the two emergency decrees passed this week fail all three of these tests and fly in the face of the government’s claim that they are upholding rights and the rule of law.”

The British Government has said it condemned the coup attempt and supported Turkey's elected government.

“We continue to call for Turkey to follow due process and respect human rights," a spokesperson for the Foreign Office told The Independent.