Washington (AFP) - The self-proclaimed mastermind of the September 11 attacks wrote to former president Barack Obama to tell him 9/11 was a direct result of American foreign policy and the deaths of innocent people it has caused.

Khalid Sheikh Mohammed's 18-page letter was addressed to "the head of the snake, Barack Obama," leader of "the country of oppression and tyranny."

Defense attorney David Nevin provided a copy of the letter, which has not yet been posted on the US military's website for Guantanamo proceedings. He told AFP that Mohammed began writing it in 2014.

The letter is dated January 8, 2015, but reached the White House only two years later in the last days of Obama's presidency, according to news reports, after a military judge ordered the Guantanamo prison camp where Mohammed is held to deliver it.

"It was not we who started the war against you in 9/11; it was you and your dictators in our land," he wrote.

He says God was on the side of the hijackers on that fateful day when airplanes were guided into the Twin Towers in New York, the Pentagon and a field in Pennsylvania.

"Allah aided us in conducting 9/11, destroying the capitalist economy, catching you with your pants down, and exposing all the hypocrisy of your long-held claim to democracy and freedom," Mohammed wrote.

Listing many grievances over America's "brutal and savage massacres" from Vietnam to the atomic bombs dropped on Hiroshima and Nagasaki, Mohammed focused his rage on the plight of Palestinians and US support for Israel and the "occupier Jews."

"Your hands are still wet with the blood of our brothers and sisters and children who were killed in Gaza," he wrote in the opening paragraph.

- 'The truth about death' -

Along with the letter, Mohammed sent a 51-page manuscript entitled "Shall I Die when the Crusaders Carry out the Death Sentence? The Truth about Death." It is illustrated with an image of a noose.

Mohammed, who faces a potential death sentence for allegedly masterminding the plane hijackings that killed almost 3,000 people, says he is not afraid of dying.

Story continues

"I speak about death happily!" he wrote.

Mohammed was waterboarded 183 times in March 2003 and held at a secret CIA prison site overseas.

In the letter, he explained that "if your court sentences me to life in prison, I will be very happy to be alone in my cell to worship Allah the rest of my life and repent to Him all my sins and misdeeds."

"And if your court sentences me to death, I will be even happier to meet Allah and the prophets and see my best friends whom you killed unjustly all around the world and to see Sheikh Osama Bin Laden," he added, referring to the late Al-Qaeda leader killed in a US raid in 2011 in Pakistan.