A once-successful Iranian businessman says he is lucky to be alive after being tortured by the Iranian authorities into a false confession of spying for Israel and assassinating Iranian nuclear scientists - a crime punishable by hanging.
The story of Mazyar Ebrahimi, who now lives abroad, also sheds a light on a bitter rivalry between Iran's intelligence agencies, as BBC Persian's Jiyar Gol reports.
I met Mazyar Ebrahimi in Frankfurt in July, several months after he called me out of the blue from Germany. I was surprised, as I had assumed he had been executed long ago.
This is because back in 2012, he and 12 other people appeared on Iranian state television to admit a range of charges that carried the death penalty.
Looking straight at the camera, they said they had been trained in Israel before returning to Iran and assassinating Iranian nuclear scientists.
The script was written by the Ministry of Intelligence - one of Iran's two main intelligence agencies - who also claimed to have dismantled an Israeli spy network.
In his hotel room, we watched a video of his alleged confession.
Still visibly shaken after all these years, Mazyar Ebrahimi says he agreed to "confess" after being tortured non-stop for about 40 days and nights.
"The interrogators were hitting the soles of my bare feet with a thick electric cable," the 46-year-old recalls.
"They broke my foot. The beatings continued for seven months."
Before his arrest by the intelligence ministry, Mr Ebrahimi ran a company that specialised in setting up TV studios. He frequently travelled abroad for the job.
He believes one of his competitors falsely accused him of spying for foreigners.
In 2010-12, four Iranian nuclear scientists were assassinated, and the Iranian intelligence service was under huge political pressure to find the perpetrators.
Mr Ebrahimi was one of more than 100 people accused of being a spy.
He says he was ready to accept any blame and wanted to die - just to stop relentless torture and humiliation.
But despite his "confession", Mr Ebrahimi says, his interrogators wanted more.
In 2011, a massive explosion destroyed a missile factory run by Iran's elite Revolutionary Guard Corps (IRGC). Scores of missile experts were killed.
Mr Ebrahimi says the intelligence agency wanted him to admit he was behind the blast.
"My interrogator said: 'Our colleagues from IRGC will ask you a few questions. You only talk about the explosion, you only say what you have been told,'" Mr Ebrahimi says.
At the time the IRGC and the intelligence ministry were fierce competitors in counter-terrorism.
And it was the questioning by an IRGC intelligence officer about seven months after he was first arrested that saved him, Mr Ebrahimi says.
The officer was furious after discovering a number of obvious discrepancies in Mr Ebrahimi's testimony fabricated by the intelligence ministry.
Suddenly, the beatings stopped, and the intelligence ministry even apologised to Mr Ebrahimi and other people facing the same charges.
But Mr Ebrahimi and other prisoners remained locked up for another 26 months, and were only released in 2015.
Rival Iranian intelligence services have been fabricating cases and forcing innocent people to confess to crimes, says Mehdi Mahdavi Azad, a Bonn-based Iranian nuclear and security expert.
He says in the past few years IRGC's intelligence falsely accused Iranian nuclear negotiators and environmentalists of spying, but the intelligence ministry later proved the cases had been made up.
After his release, Mr Ebrahimi filed a complaint against the intelligence ministry, Iran's state TV and several newspapers that falsely accused him of being an Israeli spy.
However, he withdrew the complaint after the investigating judge strongly advised that he accept compensation. He says the judge told him: "Someone could knife you in the back in a dark street. You are young, don't take the risk."
Mr Ebrahimi moved to Germany six months ago, claiming asylum there.
But even now he says he has frequent panic attacks, and his spine is damaged.
Among those who "confessed" to spying for Israel, only one person received capital punishment, Mr Ebrahimi says.
Majid Jamali Fashi was executed two months before Mr Ebrahimi's arrest.
Iranian state TV showed what it said was Mr Fashi's Israeli passport. It appears to be a doctored image of an Israeli passport taken from Wikipedia.
It is believed that Mr Fashi was detained after Wikileaks had published a leaked US diplomatic cable in 2009.
The cable appears to be related to a meeting at the US embassy in Baku, Azerbaijan, where Mr Fashi talked about oppression in Iran.
Wikileaks has not responded to a request for interview on the issue.