A US citizen jailed in Iran said in a letter released Wednesday that his captors were keeping him in harsh conditions in hopes of obtaining a prisoner swap.

Amir Mirzai Hekmati, a former Marine who holds dual citizenship, said he was kept in "miserable prison conditions" with "prolonged periods of solitary confinement."

"This is part of a propaganda and hostage-taking effort by Iranian intelligence to secure the release of Iranians abroad being held on security-related charges," the letter said.

Hekmati said he had learned through his lawyer that Iranian authorities would only free him in return for the release of two Iranians jailed overseas, whom he did not identify.

The letter was published by The Guardian which said Hekmati smuggled the letter out of jail to be sent to Secretary of State John Kerry.

A spokesman for US-born 30-year-old's family confirmed the authenticity of the letter.

Hekmati appeared on Iranian state television in December 2011 confessing in Farsi and English that he was a US spy.

In the letter, Hekmati said that the charges were false and that he was forced to make the confession. He has said that he was visiting family in Iran.

Hekmati's US-based family, in a fresh statement, appealed to Iran's new President Hassan Rowhani, who is considered a moderate.

Hekmati "has never been a spy for any country or entity or person," the family said.

"Even if one accepts the assertions by the Iranian officials as true, which we do not, Amir has served enough time and they have punished him enough," it said.

Hekmati was initially sentenced to death for espionage, but the judiciary overturned the punishment.

State Department spokeswoman Jen Psaki said that US authorities were aware of Hekmati's letter and appealed again to Iran to provide access to him "and, of course, to release him."

Psaki said the United States was also "deeply concerned" about two other US citizens -- Saeed Abedini, who was arrested after working with underground churches in Iran, and Robert Levinson, an ex-FBI agent who went missing on a 2007 trip to Iran to probe cigarette counterfeiting.