WASHINGTON — Security officers from the C.I.A. played a pivotal role in combating militants who attacked the American diplomatic mission in Benghazi, Libya, on Sept. 11, deploying a rescue party from a secret base in the city, sending reinforcements from Tripoli, and organizing an armed Libyan military convoy to escort the surviving Americans to hastily chartered planes that whisked them out of the country, senior intelligence officials said Thursday.

The account given by the senior officials, who did not want to be identified, provided the most detailed description to date of the C.I.A.’s role in Benghazi, a covert presence that appears to have been much more significant than publicly disclosed.

Within 25 minutes of being alerted to the attack against the diplomatic mission, half a dozen C.I.A. officers raced there from their base about a mile away, enlisting the help of a handful of Libyan militia fighters as they went. Arriving at the mission about 25 minutes after that, the C.I.A. officers joined State Department security agents in a futile search through heavy smoke and enemy fire for Ambassador J. Christopher Stevens before evacuating the mission’s personnel to the apparent safety of their base, which American officials have called an annex to the mission. Mr. Stevens was one of four Americans killed in the attack.

A four-hour lull in the fighting beginning shortly after midnight seemed to suggest that the worst was over. An unarmed military drone that the C.I.A. took control of to map possible escape routes relayed reassuring images to Tripoli and Washington. But just before dawn, and soon after a C.I.A.-led team of reinforcements, including two military commandos, arrived from Tripoli, a brief but deadly mortar attack surprised the Americans. Two of the C.I.A. security officers who were defending the base from a rooftop were killed.