ISLAMABAD, Pakistan — An American charged with helping plan the 2008 terrorist attacks in Mumbai, India, moved effortlessly between the United States, Pakistan and India for nearly seven years, training at a militant camp in Pakistan on five occasions, according to a plea agreement released by the Justice Department last week.

The odyssey of David C. Headley, 49, included scouting targets in several cities in India and meeting with a senior operative of Al Qaeda in Pakistan’s tribal areas. These and other new details of Mr. Headley’s activities, contained in the plea agreement, raise troubling questions about how an American citizen could travel for so long undetected from his home base in Chicago to well-established terrorist training camps in Pakistan.

The document shows that Mr. Headley made two trips to North Waziristan, the heart of Qaeda operations in the tribal area where the United States is still pushing Pakistan for a military offensive to clear out militants. His handlers, the document reveals, included a former Pakistani military commander with ties to a Pakistani extremist group and even Al Qaeda.

From there, Mr. Headley not only helped plan the Mumbai attack, it says, but he was put in contact with a Qaeda cell in Europe that may still be operative. The document shows the cell was well supplied with weapons and money and primed for an attack until the moment Mr. Headley was arrested by the F.B.I. at O’Hare airport last October.