The rapid collapse of a US diplomatic compound in Libya exposed the vulnerabilities of State Department facilities overseas.
But the CIA's ability to fend off a second attack that same night provided a glimpse of a key element in the agency's defensive arsenal: a secret security force created after the September 11, 2001, attacks.
Two Americans killed in the Libyan city of Benghazi were members of the CIA's Global Response Staff, an innocuously named organization that has recruited hundreds of former US Special Forces operatives to serve as armed guards for the agency's spies.
The GRS, as it is known, is designed to stay in the shadows, training teams to work undercover and provide an unobtrusive layer of security for CIA officers in high-risk outposts.
But a series of deadly scrapes over the past four years has illuminated the GRS' expanding role, as well as its emerging status as one of the CIA's most dangerous assignments.
Of the 14 CIA employees killed since 2009, five worked for the GRS, all as contractors.
They include the two killed at Benghazi, as well as three others who were within the blast radius on December 31, 2009, when a Jordanian double agent detonated a suicide bomb at a CIA compound in Khost, Afghanistan.
GRS contractors have also been involved in shootouts in which only foreign nationals were killed, including one that triggered a diplomatic crisis.
While working for the CIA, Raymond Davis was jailed for weeks in Pakistan last year after killing two men in what he said was an armed robbery attempt in Lahore.
The increasingly conspicuous role of the GRS is part of a broader expansion of the CIA's paramilitary capabilities over the past 10 years.
Beyond hiring former US military commandos, the agency has collaborated with US Special Operations teams on missions including the raid that killed Osama bin Laden and has killed thousands of Islamist militants and civilians with its fleet of armed drones.
CIA veterans said that GRS teams have become a critical component of conventional espionage, providing protection for case officers whose counterterrorism assignments carry a level of risk that rarely accompanied the cloak-and-dagger encounters of the Cold War.
Spywork used to require slipping solo through cities in Eastern Europe. Now, "clandestine human intelligence involves showing up in a Land Cruiser with some [former] Deltas or SEALs, picking up an asset and then dumping him back there when you are through," said a former CIA officer who worked closely with the security group overseas.
Bodyguard details have become so essential to espionage that the CIA has overhauled its training program at the Farm - its case officer academy in southern Virginia - to teach spies the basics of working with GRS teams.
The security apparatus relies heavily on contractors who are drawn by relatively high pay and flexible schedules that give them several months off each year. In turn, they agree to high-risk assignments in places such as Benghazi and are largely left on their own to take basic precautions, such as finding health and life insurance.
Current and former US intelligence officials said the GRS has about 125 employees working abroad at any given time, with at least that many rotating through cycles of training and off-time in the United States.
At least half are contractors, who often earn US$140,000 or more a year and typically serve 90- or 120-day assignments abroad.
Full-time GRS staff officers - those who are permanent CIA employees - earn slightly less but collect benefits and are typically put in supervisory roles.
The work is lucrative enough that recruiting is done largely by word of mouth, said one former US intelligence official.
Candidates tend to be members of US Special Forces units who have recently retired, or veterans of police department SWAT teams.
Most GRS recruits arrive with skills in handling the weapons they will carry, including Glock handguns and M4 rifles. But they undergo additional training so they do not call attention to the presence or movements of the CIA officers they are in position to protect.
Although the agency created the GRS to protect officers in war zones such as Iraq and Afghanistan, it has been expanded to protect secret drone bases as well as CIA facilities and officers in locations including Yemen, Lebanon and Djibouti.
In some cases, elite GRS units provide security for personnel from other agencies, including National Security Agency teams deploying sensors or eavesdropping equipment in conflict zones, a former special operator said.
The most skilled security operators are informally known as "scorpions."
"They don't learn languages, they're not meeting foreign nationals and they're not writing up intelligence reports," a former US intelligence official said.
Their main tasks are to map escape routes from meeting places, pat down informants and provide an "envelope" of security, the former official said, all while knowing that "if push comes to shove, you're going to have to shoot."
The consequences in such cases can be severe.
Former CIA officials who worked with the GRS still wince at the fallout from Davis' inability to avoid capture as well as his decision to open fire in the middle of a busy street in Pakistan.
The former security contractor, who did not respond to requests for comment, said he was doing basic "area familiarisation" work, meaning learning his surroundings and possibly mapping routes of escape, when he was confronted by two Pakistanis travelling by motorcycle.
Davis became trapped at the scene, and his arrest provoked a diplomatic standoff between two tense allies in the fight against terrorism.
The CIA took heavy criticism for the clumsiness of the Davis episode, temporarily suspending the drone campaign in Pakistan before U.S. payments to the families of the men Davis had killed helped secure his release.
By contrast, the CIA and its security units were praised - albeit indirectly - in a report released last week that was otherwise sharply critical of the State Department security failures that contributed to the deaths of four Americans in Libya three months ago.
In Benghazi, a GRS team rushed to a burning State Department compound in an attempt to rescue US diplomats, then evacuated survivors to a nearby CIA site that also came under attack.
Two GRS contractors who had taken positions on the roof of the site were killed by mortar strikes.
Among those killed was Glen Doherty, a GRS contractor on his second CIA assignment in Libya who had served in about 10 other places, including Mexico City, according to his sister, Kathleen Quigley.
"Was he aware of the risks? Absolutely," Quigley said in an interview, although she noted that "he wasn't there to protect an embassy. He was there to recover RPGs," meaning he was providing security for CIA teams tracking Libyan stockpiles of rocket-propelled grenades.
Doherty took the CIA job for the pay and abundant time off, as well as the chance to continue serving the US government abroad, Quigley said.
When Doherty died, he left debts that included loans on two houses in California, Quigley said. He had no life insurance.
CIA officials told Doherty's family that they had recommended companies willing to underwrite such policies, but that agency coverage was not available for contractors.
Quigley did not criticize the agency, but added: "It's so sad for a guy like that to go out and have nothing to show for it, except, frankly, a lot of debt."
The CIA declined to comment.
Quigley said her family has started a foundation in Doherty's name to help other families of current and former US Special Operations troops who have been killed.
A separate organisation performs a similar function for families of slain CIA officers.
The CIA Memorial Foundation pays college costs for children of CIA officers who were killed and recently began providing payments of about US$5,000 to families to help pay for funeral-related costs.
The organisation is paying tuition and other costs for 28 dependents of slain agency employees, and an additional 77 will be eligible when they reach college age, said Jerry Komisar, a CIA veteran who is president of the foundation.
The organisation's obligations have grown in recent months, a stretch that ranks as among the deadliest for the CIA since the attack on Khost.
After Doherty and Tyrone Woods were killed in Benghazi, three other CIA officers - all staff employees - were killed in Afghanistan.
The foundation covers contractors who work for the GRS.
"I often wonder why people take those kinds of risks," Komisar said. "It's got to be an opportunity for them to bring in more cash. But the downside is, you put yourself at great risk. My heart goes out to them."
The Washington Post