Before convicted terrorist David Headley plotted the attack that killed 160 people - including six Americans - U.S. agents overlooked his growing radicalization in the belief he was actually working for them.
A Chicago court heard testimony that two U.S. Federal Bureau of Investigation agents showed up on Mr. Headley's doorstep in Philadelphia in late 2001, checking tips that Mr. Headley was talking openly about joining an armed jihadist movement - even in the aftermath of 9/11.
A consummate chameleon with a remarkable ability to blend in, strike deals and speak half-truths, Mr. Headley says he told the FBI his rhetoric was a ruse.
"You said: 'I'm going into mosques working for you.' " lawyer Charles Swift said Wednesday.
"Yes," said Mr. Headley who, at the time, actually was an undercover agent being run into Pakistan by the U.S. Drug Enforcement Agency.
Mr. Headley's strange life of globetrotting intrigues ended when the FBI arrested him in Chicago in 2009.
Held on suspicion of plotting the Mumbai Massacre for a Pakistani terror group known as Lashkar-e-Taiba, Mr. Headley quickly turned informer - but only after Northern Illinois Attorney-General Patrick Fitzgerald assured him that a guilty plea with full co-operation meant no death penalty.
For the past three days, Mr. Headley has been laying out his life story while giving evidence against Tahawwur Rana, a Pakistani-Canadian whose Chicago immigration consultancy provided the fake credentials Mr. Headley used to sneak into India and videotape targets. If convicted of helping plan the Mumbai Massacre, Mr. Rana could spend the rest of his life in prison.
Mr. Rana says he was duped by his lifelong friend.
According to Mr. Headley's testimony, it was a schoolyard fight at a Pakistani military boarding school that first brought the two men together. Mr. Rana was said to be merely an onlooker, but one who felt afterward that he had to get to know the white boy who swore a blue streak in Punjabi as he engaged in fisticuffs.
Born to an American mother and Pakistani father who had split up, Mr. Headley flunked out of the Pakistani school and went to work in his mother's bar in Philadelphia, dubbed the Khyber Pass. At age 18, the devoutly Islamic Mr. Rana visited his American friend, and was surprised to learn Mr. Headley was drinking, doing drugs and dating.
The two men next met in their 20s. Mr. Headley testified he conned Mr. Rana, then an army doctor, into sharing a car ride to the Afghanistan-Pakistan border. Mr. Headley said he calculated, correctly, that his friend's military pass would keep authorities from searching the car for the contraband heroin he picked up at the border.
In the 1990s, Mr. Headley was busted by U.S. drug authorities for dealing Afghan heroin, but he managed to parlay that arrest into opportunity. After serving a lenient sentence, between 1999 and 2002, Mr. Headley worked as an undercover mole for the U.S. Drug Enforcement Agency during his visits to Pakistan.
A white-skinned American Muslim who speaks Hindi, Punjabi, and Urdu, Mr. Headley's background made him a highly attractive agent - and not just to the Americans. In 2000, he began to attend Lashkar-e-Taiba meetings in Pakistan where, Mr. Headley says, he heard speeches advocating that "one second spent conducting jihad was superior to 100 years praying."
By 2002, Mr. Headley testified, he was taking paramilitary courses in Pakistan with an eye to fighting Indian forces in Kashmir.
The higher-ups had other plans. In 2006, Mr. Headley testified, he was introduced to a Major Iqbal - reputedly a Pakistani government spy - inside a military compound affiliated with Pakistan's Khyber Rifles force. Dismissive of the Lashkar training, Major Iqbal is said to have taught Mr. Headley spycraft.
During the 2008 Mumbai Massacre, 10 Pakistani gunmen killed scores of people at luxury hotels, the train station, and a Jewish centre that Mr. Headley had spent months videotaping in the runup to the attacks.
In the aftermath, Mr. Headley went to Copenhagen to scout new targets. He testified his hope was to avenge the insult to Islam made by the Denmark cartoonists who drew caricatures of the Prophet Mohammed. "I wanted a lot of reward from God," Mr. Headley testified.
The FBI arrested Mr. Headley at the Chicago airport in 2009. He was caught carrying a book called How to Pray Like a Jew.
"I thought I might like to visit the synagogues in Copenhagen," Mr. Headley nonchalantly explained during his testimony.