In the marble corridors of the Istanbul Palace of Justice, dozens of people press against a metal barrier in the hope of catching a glimpse of a family member – a son, husband or brother – detained in the aftermath of the bloody coup attempt.

As a file of handcuffed soldiers is led in, the crowd surges forward. One woman shouts the name of her brother before he vanishes behind a courtroom door. When a lawyer makes her way towards the crowd, she is immediately surrounded and showered with questions: will there be a decision? Who was detained, and who released?

Since the coup attempt in Turkey on 15 July that left at least 265 people dead and more than 1,000 wounded, tens of thousands of military personnel, judges, prosecutors and civil servants have been detained or suspended from their jobs as part of the investigation into possible plotters. The Turkish government immediately fingered US-based cleric Fethullah Gülen, a long-time ally of Turkish president Recep Tayyip Erdoğan now turned foe, as the mastermind of the attempted military takeover.

On Saturday his nephew, Muhammed Sait Gülen, was detained in the northeastern Turkish city of Erzurum and is to be taken to Ankara for questioning.

However, analysts have said that a coalition of several factions in the army is a more likely scenario, underlining that many questions concerning the failed military intervention remain to be answered. But many are concerned about the massive purge launched last week and warn that the right to a fair trial is increasingly in peril as a result.

Late on Wednesday evening Erdoğan announced a three-month state of emergency, enabling him and the Justice and Development party (AKP) cabinet to bypass parliament, rule via decree, and suspend rights and freedoms as they deem necessary. The first decree, announced on Saturday, extends pre-charge detention from four to 30 days and orders the closure of more than 2,000 private schools, associations, foundations, unions, health institutions and universities.

He was a simple recruit and he did what his commanders told him. I love my country. My son loves his country Ahmet Yildiz

“The coup attempt did a lot of damage to the democratic opposition in Turkey,” said one human rights lawyer. “This could have been a chance for Turkey to overcome polarisation and violence, to finally democratise the country. But instead it is used as a pretext for Erdoğan to galvanise power.”

Emine and Ahmet Yildiz have travelled 250 miles from their small hometown to Istanbul. For four days they have waited in the stone halls of the Istanbul Palace of Justice for news from their detained son, a professional soldier in his early 20s. On the night of the coup attempt he drove a lorry. That is all they know because they were able to speak to their son only once, over the phone.

“He had just signed a contract a few months prior to these bad events,” says Ahmet Yildiz, who, like his wife, works in a factory for the minimum wage. “He had finished his university studies and could not find a job. He was a simple recruit, and he did what his commanders told him. I love my country. My son loves his country.” He adds that he feels uneasy about the nightly “democracy watches” on public squares all over the country, to which the government has been inviting citizens via speeches, text messages and social media day after day.

“It was a terrible night. Many people died, all of them were our people. My son has been declared a terrorist but my neighbours are celebrating in the streets. It’s not right. I, too, want to live in a democracy but it has to be a democracy for everyone.”

The family’s second son is doing his compulsory military service in the predominantly Kurdish south-east, where violence has surged after a breakdown of the ceasefire between the Turkish government and the outlawed Kurdistan Workers’ party (PKK) last summer.

“We have not told him about his brother,” says Emine Yildiz. “We have lied to him for a week, for fear that he would desert to be with us here.” She fights back tears. “All these families here are poor. They would not send their sons to the army otherwise. Have you ever seen the son of a minister serving in the south-east?”

By Saturday morning almost 7,500 military personnel had been detained on accusations of being involved in the coup attempt. According to the state news agency, Anadolu, 133 of those detained were generals and admirals, of whom 126 have been formally arrested. On Sunday, it was announced that the presidential guard would be disbanded, after 300 of the 2,500 officers from the elite unit were rounded up over suspected links to the coup.

However, the swift purge did not only target the Turkish military. During the week, almost 1,000 judges and prosecutors were detained and at least 2,745 judges were suspended from duty. According to the head prosecutor in Ankara, 1,200 privates had been released from custody by Saturday morning. Regular court hearings were delayed for hours due to a lack of personnel, and courts appointed to question the thousands of detained suspected coup plotters are working overtime. “An already overstretched judiciary is now at breaking point,” one lawyer said. “How will they run a country after decimating so many state institutions? We simply don’t know.”

Reports have started to emerge of ill-treatment and torture of soldiers detained on charges of involvement in the coup plot. “We have seen a very disturbing picture of severe ill-treatment taking place in places of detention, especially targeting officers,” said Andrew Gardner, Turkey researcher for Amnesty International. “There are reports of severe beatings, of the denial of food and drink, of having to remain in painful positions for extended periods of time. We have also received reports of sexual torture.” The human rights group is expected to publish more detailed information on torture allegations.

Many have expressed concern that the AKP government will turn the investigation of the coup plot into a witch-hunt against all opposition figures.

In addition to security and judiciary personnel, more than 50,000 civil servants were suspended from their jobs, including 15,000 teachers. Thousands of passports of citizens employed in state institutions have been revoked.

Last week Turkey’s Council of Higher Education (YÖK) issued a foreign travel ban for all university employees. Several news websites with alleged ties to Gülen were shut down, and 34 government-issued press cards were cancelled. Seven academics were formally arrested. Ten others, all of whom had signed a petition in January condemning the government’s brutal crackdown on Kurds, were fired.

On Thursday police took prominent human rights lawyer and commentator Orhan Kemal Cengiz into custody at Atatürk airport on unknown charges. A day later, a court extended his detention by 24 hours and his lawyer, Ali Koç, said that he had not yet been able to speak to him and did not know what he was being accused of.

Human rights groups have warned that Turkey, even in a state of emergency, needs to remain within the framework of international law.

“We don’t have full evidence that the government will use this situation to get rid of all opposition,” said Emma Sinclair-Webb, Turkey director for Human Rights Watch.

“However, there is a sense that the purge, especially the mass sacking of teachers and judges suspected of Gülenist sympathies, goes far beyond the legitimate investigation into the coup plot. The severity of the original crime is now used to justify this massive crackdown,” she added.