ISTANBUL — Turkey’s president has defended the sweeping crackdown that has seen the detention of thousands of judges and prosecutors following July’s failed coup, asserting on Thursday that it will boost the judiciary.

President Recep Tayyip Erdogan, speaking at the presidential complex in Ankara to an audience of judges and prosecutors for the opening of the judicial year, said that the detention of 3,495 judges and prosecutors so far “would not weaken the judiciary, quite the contrary I believe it will cause significant relief in the implementation of real justice.”

After the failed July 15 coup that left at least 270 people dead, the Turkish government declared a state of emergency and launched a massive crackdown against supporters of the movement led by U.S.-based Islamic cleric Fethullah Gulen, whom Ankara deemed responsible for the uprising. Gulen denies any involvement.

On Thursday, the Minister of National Defence announced 820 personnel were dishonourably discharged from the Army and Navy. Of those, 648 were already under arrest.

Turkey’s state-run Anadolu news agency reported that so far 4,451 military personnel have been discharged since the coup, including 151 generals and admirals.

Some 35,000 people have been detained for questioning and more than 17,000 of them have been formally arrested to face trial, including soldiers, police, judges, prosecutors and journalists. Tens of thousands have been dismissed from their jobs.

Earlier this week Erdogan had called all citizens who knew of anyone affiliated with Gulen’s movement to inform them to police and prosecutors. The crackdown has raised concerns among Turkey’s Western allies and human rights organizations, who have urged the government to show restraint.