Media captionMark Lowen spoke to men who say they were tortured. Some may find their testimony disturbing

Selcen Bayun plays the video on her phone - and takes a deep breath. Even after watching it multiple times since 15 July, it still shocks.

"That's my client." she says, pointing to a man with a head injury. "He and the others were beaten, their heads were banged against the wall and he had burns on his legs from being forced to kneel on hot asphalt. I saw a police officer throttling another client during an interrogation."

The men in the video are high-level suspects behind the attempted coup earlier this year.

They are military officers, accused of commandeering F16 fighter jets to bomb Turkey's parliament and other official buildings, as well as ordering tanks to fire at protesters in Istanbul and Ankara.

What was perhaps the gravest ever attack on the Turkish state killed at least 265 people and almost overthrew President Recep Tayyip Erdogan.

It has led to the biggest purge in Turkey's modern history, with more than 125,000 people dismissed or suspended and around 40,000 others arrested, charged with links to the Islamic movement of Fethullah Gulen, the cleric who the government says was behind the coup attempt.

Allegations of mistreatment in custody are emerging, and the BBC has heard compelling and worrying testimony.

Image caption
Allegations of torture began to gain credibility with pictures like this one of heavily-injured men

"They had broken ribs from beatings, cuts to their wrists from being handcuffed behind their backs and fractures to the skull," says Selcen Bayun.

"With heavy restrictions on the lawyer-client relationship, police and guards sit in on every meeting we have with the client - they even involve themselves in the conversation - and read every letter. Our clients are frightened about saying what they've been through."

The video Selcen plays was released shortly after the coup, with alleged plotters paraded in front of the cameras apparently with broken noses and severe head and ear injuries. Another video posted online, seemingly shot by a policeman, appears to show soldiers kicked and bloodied.

Image copyrightEPAImage caption
About 40,000 people were arrested following the failed coup attempt

Image caption
The BBC was shown video of bloodied, kicked Turkish soldiers in a cell

Human rights group Amnesty International recently said it had "credible reports" of detainees being subjected to "beatings and torture, including rape", while Human Rights Watch documented several cases of alleged abuse, facilitated by a state of emergency that extends police detention from four to 30 days and denies access to a lawyer for up to five days.

The BBC uncovered more testimony of alleged abuse, not just from suspected coup-plotters but from others caught up in the purge accused of "support for terrorism", including Kurds and leftists.

Kamil Uluc was detained in August, accused of links to the banned Kurdish militant group PKK. He was held at Esenler and Vatan police stations in Istanbul where he claims he was severely tortured.

In a long, detailed account, he told the BBC it started with a gun being put in his mouth to order him what to say, not allowing him a toilet break so he would soil himself - to far worse.

Image caption
Human rights groups say they have credible reports of torture. Kamil Uluc says this burn mark is the result of torture

"They had pictures of about 200 people and were telling us to say they were PKK. When I refused, the torture started. They tied weights to our testicles. I still feel pain around my groin. Then they would pour water on us and beat us. We were taken to hospital but the police ordered the doctor not to record anything".

There were multiple claims of pressure on medical staff to sign off reports without a proper check-up.

Kamil continues. "'If you don't speak, we'll bring your wife here and rape her in front of your eyes', they said. Then they took me to a dark room and tried to forcefully insert a baton into my anus. When they couldn't do it, they left. Maybe I will forget the other torture - but for the sexual part, it is carved into the dirtiest corner of my heart."

The BBC obtained the medical report of another two men who allege sexual abuse. Arrested in the southern city of Urfa for being part of a Marxist group, the report talks of "lesions on the back of the penis and pain in the scrotum, consistent with squeezing the penis and scrotum".

Political opponents are being targeted too. When the leaders and MPs of the pro-Kurdish opposition party, the HDP, were arrested, Cihad Saatcioglu, the son of one MP, was detained in a protest. The injuries he suffered in custody were so serious that he was admitted to hospital, where the BBC managed to visit him.

Image caption
Cihad Saatcioglu had to be taken to hospital because of his injuries

He cries in pain when he's moved in bed, because of a fractured vertebra. His medical report, which was obtained by the BBC, talks of beating, head trauma, damage to the skull and lesions. A large bandage is lifted up on his back to reveal a deep red wound.

"From the moment I was detained until I was brought to hospital I was constantly beaten," he says. "It was endless - slapping, kicking, banging our heads against the wall. When I got to hospital, they tried to pressure the doctors but the medical reports confirmed what had happened so the police ran off and were replaced by others.

"If it was only a few officers, you might think it was an exception. But it was the motorcycle police, plain-clothes ones, anti-terror - they were all there. They were confident while torturing us."

Torture was widespread in Turkey through the coups and Kurdish militancy of the 1980s and 1990s. It decreased with the AK Party government from 2004 with safeguards and better medical and legal access. But since the Kurdish conflict resumed last year, followed by the attempted coup, it seems the dark days are returning.

Human rights in Turkey

Image copyrightAP

Media face unprecedented pressure from the government

Violations of right to freedom of peaceful assembly

Increase in cases of excessive use of force by police and ill-treatment in detention

Impunity for human rights abuses

Sources: Amnesty International and Human Rights Watch

The government refused the BBC requests for comment. But after the Human Rights Watch report last month, the Justice and Interior ministries called it "one-sided, only with the biased viewpoints of the Gulenist Terror Group", adding that "the Turkish state upholds the rule of law regarding the mistreatment of prisoners and torture." The justice minister tweeted that the allegations were "slander".

Image copyrightTwitter - @bybekirbozdagImage caption
A tweet by Turkey's Justice Minister says: "There is no mistreatment or torture in Turkish prisons. Those who say otherwise are slanderers if they can't prove their claims"

The UN Special Rapporteur on Torture is in Turkey this week after an earlier request for a visit was postponed by the Turkish government. His assessment will be key to determining if Turkey is indeed breaking international law by torture: a prohibition that is absolute and cannot be suspended even in times of war of national emergency.

As the interview with the lawyer Selcen Bayun comes to an end, I ask if she's afraid to speak out. "Yes - but somebody has to talk", she says. "What happened on 15 July was completely unlawful - but what is happening now is unlawful too. We just want justice".