It was late afternoon, Sunday 21 April 2002, when I packed my bags before joining Khalid Sheikh Mohammed and Ramzi bin al-shibh for a last prayer before saying goodbye.

After nearly 48 hours with them the last moments in that Karachi safe house were bizarrely emotional. Ramzi hugged me closely, and Khalid handed me a statement called The Operation of the Jewish Synagogue in Djirba, Tunisia.

"You can read it later," he said. Then he insisted on leading the way down the stairs - a very uncharacteristic act for someone as security conscious as him. "You know what!" Khalid said as we walking down. "You would make the perfect terrorist. I mean, look at yourself! You are young, intelligent, highly educated, well organised, you speak good English, you live in London, and you are single."

I presumed he was joking but, blindfolded, I could not see whether he was smiling. He went on: "You remind me in a sense of brother Atta." A comparison with Mohammed Atta, the leader of the September 11 hijackers, would have been in his eyes a huge compliment. How do you respond to such a comment? It needed a delicate reply, so I said: "One of Allah's dearest blessings is that no human being can read the minds of their fellow human beings."

Indicted



Khalid seemed content. Before the September 11 attacks few people, even intelligence agents, had heard of Khalid Sheikh Mohammed. True, he had been indicted for his role in a 1995 Philippines-based plot to crash US airliners into the sea, but no one had ever questioned him for this - or for his alleged role in the first attack on the World Trade Centre in 1993.

Until his arrest this week the only known photograph of him was a strange passport picture of a man staring out from under a Gulf Arab headdress, his thick beard and glasses obscuring most of his features. It glowers at you on the FBI Most Wanted website, along with an electronically enhanced version of the same picture showing him wearing a shirt and collar and cleanly shaven.

The details on the website are sketchy and contradictory: he was born on 14 April 1965 or 1 March 1965. His place of birth is Kuwait or Pakistan. He is olive or light skinned. He wears a full beard, a trimmed beard or a shaven face and is also known to wear glasses to hide his brown eyes.

It was only after my 48-hour encounter with the masterminds of the "Holy Tuesday" operations in New York and Washington that the world, including the CIA and FBI, came to learn that Khalid Sheikh Mohammed is al-Qaida's number three and that his importance to the group as a terrorist organiser in the field exceeds that of his boss, Bin Laden.

When I arrived after a long series of changing cars and guides, it was Khalid who removed my blindfolds. "Recognised us yet?" he joked as Ramzi shook my hand warmly. "You will when intelligence dogs turn up at your door," Ramzi said.

"They say that you are terrorists," I surprised myself by blurting out. Calm and serene, Ramzi just offered an inviting smile. Khalid answered: "They are right. That is what we do for a living." Ramzi then said: "If terrorism is to throw terror into the heart of your enemy and the enemy of Allah then we thank Him, the Most Merciful, the Most Compassionate, for enabling us to be terrorists."

Khalid outlined the conditions for my interviews. I was not to mention how we communicated, nor reveal their "real" code-names. "When they ask you what we now look like, you will say we have not changed at all since the photos they will show you were taken." I was asked to place my right hand on a copy of the Holy Koran and solemnly swear to this.

Summoning every thread of experience and courage, I looked Khalid in the eye and asked: "Did you do it?" The reference to September 11 was implicit. Khalid responded with little fanfare: "I am the head of the al-Qaida military committee," he began, "and Ramzi is the coordinator of the Holy Tuesday operation. And yes, we did it."

He went on: "About two and a half years before the holy raids on Washington and New York, the military committee held a meeting during which we decided to start planning for a martyrdom operation inside America. As we were discussing targets, we first thought of striking at a couple of nuclear facilities but decided against it for fear it would go out of control."

I was dumbfounded. Nuclear targets? Could he be more specific?

"You do not need to know more than that at this stage, and anyway it was eventually decided to leave out nuclear targets for now."

"What do you mean 'for now'?"

"For now means 'for now'," Khalid said, silencing me.

The attacks, he said, were designed to cause as many deaths as possible. It would be a huge slap in the face for America, on its own soil. But who would carry it out? "We were never short of potential martyrs. Indeed, we have a department called the department of martyrs."

Aliases



Was it still active? "Yes it is, and it always will be as long as we are in jihad against the infidels and the Zionists."

When the time came to start filming I sat in front of the camera and invited Khalid to have a look into the viewfinder. "What do you think?"

But Khalid was not happy. He yelled at an associate: "Bring me that brown cloak, will you?" With the help of Ramzi he pinned the cloak to the wall in front of the camera and had another look through the lens to see if the colour worked on film. Still, he was not happy.

He disappeared for a moment and came back dressed in a large loose brown cloak, almost identical to the other one, covering him from neck to toes. As everybody was laughing, he took it off, placed it on Ramzi's shoulders and asked him to sit in front of the camera so that he could have yet another look. "It is OK now," he declared, "we can now begin. Sit in front of me."

When the camera started rolling Khalid Sheikh Mohammed was different. He tried to sound authoritative, but stumbled as he tried to compose a couple of sentences in classical Arabic.

During the 70 minutes on camera he referred to Osama bin Laden as "Sheikh Abu Abdullah", sometimes "Sheikh Osama" or simply "the Sheikh", but always in the present tense, and always praying to Allah to protect him. Once, though, he made what I thought was a slip of the tongue, referring to him in the past tense.

After the interview Khalid went off to another room and came back with a small box. "This is for you," he said as he opened the box and started to hand me some CD-roms and mini cassettes, including a will made by one of the September 11 hijackers, a documentary on what Khalid called the "new crusades" and a video of the beheading of the Wall Street Journal's reporter Daniel Pearl.

He said he wanted me to distribute the tapes to western news agencies, adding quizzically: "Especially the French."

When Ramzi bin al-Shibh was arrested on the first anniversary of their "finest hour", September 11, I was surprised. I am shocked by the unceremonious arrest of Khalid Sheikh Mohammed. The man who planned and orchestrated the most sophisticated act of terror in history can, it seems, make mistakes.

I believe that he was sold out rather than hunted down. The manner of his fall tells us less about the bravery of the Pakistanis or the cleverness of the Americans - the official view - than about the disruption that has shaken the heart of al-Qaida. His place, however, will soon be claimed by more than one new "mastermind". Given the boiling emotions in the Arab and Muslim world at present, they will be hailed.

· Yosri Fouda is the chief investigative reporter for al-Jazeera channel. His book Masterminds of Terror, with Nick Fielding, will be published shortly by Mainstream Publishing