In the early years after 9/11, the CIA turned some Guantanamo Bay prisoners into double agents then sent them home to help the U.S. kill terrorists, current and former U.S. officials said.

The CIA promised the prisoners freedom, safety for their families and millions of dollars from the agency's secret accounts.

It was a risky gamble. Officials knew there was a chance that some prisoners might quickly spurn their deal and kill Americans.

For the CIA, that was an acceptable risk in a dangerous business. For the American public, which was never told, the program was one of the many secret trade-offs the government made on its behalf. At the same time the government used the risk of terrorism to justify imprisoning people indefinitely, it was releasing dangerous people from prison to work for the CIA.

The program was carried out in a secret facility built a few hundred yards from the administrative offices of the prison in Guantanamo Bay, Cuba. The eight small cottages were hidden behind a ridge covered in thick scrub and cactus.

The program and the handful of men who passed through these cottages had various official CIA code names.

But those who were aware of the cluster of cottages knew it best by its sobriquet: Penny Lane.

It was a nod to the classic Beatles song and a riff on the CIA's other secret facility at Guantanamo Bay, a prison known as Strawberry Fields.

Nearly a dozen current and former U.S officials described aspects of the program to The Associated Press. All spoke on condition of anonymity because they were not authorized to discuss the secret program publicly by name, even though it ended in about 2006.

Some of the men who passed through Penny Lane helped the CIA find and kill many top Al Qaeda operatives, current and former U.S. officials said. Others stopped providing useful information and the CIA lost touch with them.

When prisoners began streaming into Guantanamo Bay in January 2002, the CIA recognized it as an unprecedented opportunity to identify sources. That year, 632 detainees arrived at the detention center. The following year 117 more arrived.

"Of course that would be an objective," said Emile Nakhleh, a former top CIA analyst who spent time in 2002 assessing detainees but who did not discuss Penny Lane. "It's the job of intelligence to recruit sources."

By early 2003, Penny Lane was open for business.

Candidates were ushered from the confines of prison to Penny Lane's relative hominess, officials said. The cottages had private kitchens, showers and televisions. Each had a small patio.

Some prisoners asked for and received pornography. One official said the biggest luxury in each cottage was the bed — not a military-issued cot but a real bed with a mattress.

The cottages were designed to feel more like hotel rooms than prison cells, and some CIA officials jokingly referred to them collectively as the Marriott.

Current and former officials said dozens of prisoners were evaluated but only a handful, from a variety of countries, were turned into spies who signed agreements to work for the CIA.

CIA spokesman Dean Boyd declined to comment.

The U.S. government says it has confirmed that about 16 percent of former Guantanamo Bay detainees rejoined the fight against America. Officials suspect but have not confirmed that 12 percent more rejoined.

It's not clear whether the men from Penny Lane are included in those figures. But because only a small number of people went through the program, it would not likely change the figures significantly either way. None of the officials interviewed by the AP knew of an instance in which any double agent killed Americans.

Though the number of double agents recruited through Penny Lane was small, the program was significant enough to draw keen attention from President George W. Bush, one former official said. Bush personally interviewed a junior CIA case officer who had just returned home from Afghanistan, where the agency typically met with the agents.

President Barack Obama took an interest the program for a different reason. Shortly after taking office in 2009, he ordered a review of the former detainees working as double agents because they were providing information used in Predator drone strikes, one of the officials said.

Infiltrating Al Qaeda has been one of the CIA's most sought-after but difficult goals, something that other foreign intelligence services have only occasionally accomplished. Candidates for Penny Lane needed legitimate terrorist connections. To be valuable to the CIA, the men had to be able to reconnect with Al Qaeda.

From the Bush administration descriptions of Guantanamo Bay prisoners at the time, the CIA would have seemingly had a large pool to draw from. Vice President Dick Cheney called the prisoners "the worst of a very bad lot." Defense Secretary Donald H. Rumsfeld said they were "among the most dangerous, best trained, vicious killers on the face of the Earth."

In reality, many were held on flimsy evidence and were of little use to the CIA.

While the agency looked for viable candidates, those with no terrorism ties sat in limbo. It would take years before the majority of detainees were set free, having never been charged. Of the 779 people who were taken to Guantanamo Bay, more than three-fourths have been released, mostly during the Bush administration.

Many others remain at Guantanamo Bay, having been cleared for release by the military but with no hope for freedom in sight.

"I do see the irony on the surface of letting some really very bad guys go," said David Remes, an American lawyer who has represented about a dozen Yemeni detainees at Guantanamo.

But Remes, who was not aware of Penny Lane, said he understands its attraction.

"The men we were sending back as agents were thought to be able to provide value to us," he said.

Prisoners agreed to cooperate for a variety of reasons, officials said. Some received assurances that the U.S. would resettle their families. Another thought Al Qaeda had perverted Islam and believed it was his duty as a Muslim to help the CIA destroy it. One detainee agreed to cooperate after the CIA insinuated it would harm his children, a former official said, similar to the threats interrogators had made to admitted 9/11 mastermind Khalid Sheikh Mohammed.

All were promised money. Exactly how much each was paid remains unclear. But altogether, the government paid millions of dollars for their services, officials said. The money came from a secret CIA account, codenamed Pledge, that's used to pay informants, officials said.

The arrangement led to strategic discussions inside the CIA: If the agency's drones had a shot at Osama bin Laden or his deputy, Ayman al-Zawahri, would officials take the shot if it meant killing a double agent on the American payroll?

It never came to that.

The biggest fear, former officials involved with the program recalled, was that a former detainee would attack Americans then publicly announce that he had been on the CIA payroll.

Al Qaeda suspected the CIA would attempt a program like this and its operatives have been very suspicious of former Guantanamo Bay detainees, intelligence officials and experts said.

In one case, a former official recalled, Al Qaeda came close to discovering one of the double agents in its midst.

The U.S. government had such high hopes for Penny Lane that one former intelligence official recalled discussions about whether to secretly release a pair of Pakistani men into the United States on student or business visas. The hope was that they would connect with Al Qaeda and lead authorities to members of a U.S. cell.

Another former senior intelligence official said that never happened.

Officials said the program ended in 2006, as the flow of detainees to Guantanamo Bay slowed to a trickle. The last prisoner arrived there in 2008.

Penny Lane still stands and can be seen in satellite photos. A dirt road winds its way to a clearing. The special detachment of Marines that once provided security is gone. The complex is surrounded by two fences and hidden among the trees and shrubs of Guantanamo Bay.

It has long been abandoned.