WASHINGTON — Confined to the basement of a CIA secret prison in Romania about a decade ago, Khalid Sheikh Mohammed, the admitted mastermind of the 9/11 terrorist attacks, asked his jailers whether he could embark on an unusual project: Would the spy agency allow Mohammed, who had earned his bachelor’s in mechanical engineering, to design a vacuum cleaner?

The agency officer in charge of the prison called CIA headquarters and a manager approved the request, a former senior CIA official told The Associated Press.

Mohammed had endured the most brutal of the CIA’s harsh interrogation methods and had confessed to a career of atrocities. But the agency had no long-term plan for him. Someday, he might prove useful. Perhaps, he’d even stand trial one day.

And for that, he’d need to be sane.

“We didn’t want them to go nuts,” the former senior CIA official said, one of several who spoke on condition of anonymity because they were not authorized to talk about the now-shuttered CIA prisons or Mohammed’s interest in vacuums.

So, using schematics from the Internet as his guide, Mohammed began re-engineering one of the most mundane of household appliances.

That the CIA may be in possession of the world’s most highly classified vacuum cleaner blueprints is but one peculiar, lasting byproduct of the controversial U.S. detention and interrogation program.

By the CIA’s own account, the program’s methods were “designed to psychologically ‘dislocate”‘ people. But once interrogations stopped, the agency had to try to undo the psychological damage inflicted on the detainees.

The CIA apparently succeeded in keeping Mohammed sane. He appears to be in good health, according to military records.

Others haven’t fared as well. Accused al-Qaida terrorists Ramzi Binalshibh and Abd al-Nashiri, who were also locked up in Poland and Romania with Mohammed, have had mental issues. Al-Nashiri suffers from depression and post-traumatic stress disorder. Binalshibh is being treated for schizophrenia, with a slew of anti-psychotic medications.

“Any type of prolonged isolation in custody — much less the settings described in the press — have been known to have a severe impact on the mental condition of the detainee,” said Thomas Durkin, Binalshibh’s former civilian lawyer. Durkin declined to discuss Binalshibh’s case.

Mohammed was subjected to harsh interrogations in Poland. Agency officers and contractors forced him to stay awake for 180 hours, according to a CIA inspector general’s report. He also underwent 183 instances of waterboarding, or simulated drowning.

After the CIA prison in Poland was closed in September 2003, Mohammed was moved to Bucharest, to a black site code-named “Britelite.” Soon the CIA was trying to find ways to entertain Mohammed as his intelligence value diminished.

The prison had a debriefing room, where Mohammed, who saw himself as something of a professor, held “office hours,” as he told CIA officers. While chained to the floor, Mohammed would lecture the CIA officers on his path to jihad, his childhood and family. Tea and cookies were served.

Along with the other five detainees at the prison in Bucharest, Mohammed was given assignments about his knowledge of al-Qaida, or “homework,” as CIA officers called it. He was given Snickers candy bars as rewards for his studiousness.

In Romania, the prison provided books for detainees to read. Mohammed, former officials said, enjoyed the Harry Potter series. For the CIA officers at the prison, not so much. For security reasons, after a prisoner finished a book, they tediously checked every page to ensure detainees weren’t passing messages. They once caught Mohammed trying to hide a message in a book warning his prison mates not to talk about Osama bin Laden’s courier.

Mohammed graduated from North Carolina A&T State University with a degree in mechanical engineering in 1986. It’s not clear whether Mohammed was interested in designing a better vacuum or had ulterior motives. He might have intended to use the plans to conceal secret information or trick his jailers.

In Graham Greene’s spy thriller “Our Man in Havana,” a vacuum salesman in Cuba agrees to work for MI6, the British spy service. He dupes the British into believing his vacuum designs are military installations. The AP was unable to determine whether Mohammed ever read the famous novel.