The mastermind of 9/11 attacks Khalid Sheikh Mohammed has backtracked on his previous terrorists beliefs saying that the Holy Koran forbids the use of violence to spread Islam.

In a 36-page manifesto released to the Huffington Post and Channel 4 News, Mohammed, who has been held in a US prison in Cuba's Guantanamo Bay since 2006, said it is his "religious duty" to convert non-Muslims such as the people in court through persuasion and theological dialogue.

He condemned "those who claim that the Mujahedeen fight infidels to turn them to Islam or that we are fighting you because you practice democracy, freedom or claim that you uphold human rights".

"Don't believe the media that the Mujahedeen believe that Islam spread in the past and will prevail in the future with the sword [...] The Holy Koran forbids us to use force as a means of converting," he wrote.

Mohammed, 49, is the most high-profile of the five men accused over the 2001 attacks that killed nearly 3,000 people on US soil. The document is his first public communication since 2009, when he was accused of terrorism. Before his detention in Guantanamo, he was tortured by the CIA at "black sites" in undisclosed locations. He claims to have beheaded American journalist Daniel Pearl.

The alleged al-Qaida member, who was captured in 2003 in Pakistan, told a military commission in 2007 that he had planned the 9/11 attacks "from A to Z". But now he accuses the media and the intelligence service of misleading the public: "They hide from them why the Mujahedeen carried out 9/11 and what the truth is about the War on Terror," he writes.

While he condemns violence, Mohammed remains firm on the condemnation of Western costumes and capitalism. In the letter, he says that it is not necessary "to have money, houses, or possessions to be happy" – a statement that eerily resembles comments made by reformist Pope Francis.

Mohammed condemns gay marriages saying that "by God's laws, these acts are considered social crimes and it will cause unhappiness in their life".

The letter even takes a social turn when the man underlines the US military suicide rate.

"Hundreds of American crusader soldier men and women join the US army, wear the latest military gear, eat the best food in Iraq and Afghanistan, and play with their play stations while their enemies, the poor Muslim can't find their daily bread or jacket to protect themselves from the harsh snowstorms over Afghanistan mountains, but at the end, the American soldiers go home and commit suicide but the poor man still with his dry bread and black tea lives with his poor wife in their humble muddy house but with happy hearts and souls."

He carries on saying that even a poor detainee "may be happy while being water-boarded or tortured or even in solitary confinement where he can't see the sun and the moon".

"With my current condition, I live in solitary confinement but I am very happy in my cell because my spirit is free even while my body is being held captive".

The alleged terrorist started writing his essay back in 2009 on a laptop that was later seized.