WASHINGTON — In the months leading up to the Sept. 11 attacks on the American diplomatic mission in Benghazi, the Obama administration received intelligence reports that Islamic extremist groups were operating training camps in the mountains near the Libyan city and that some of the fighters were “Al Qaeda-leaning,” according to American and European officials.

The warning about the camps was part of a stream of diplomatic and intelligence reports that indicated that the security situation throughout the country, and particularly in eastern Libya, had deteriorated sharply since the United States reopened its embassy in Tripoli after the fall of Col. Muammar el-Qaddafi’s government in September 2011.

By June, Benghazi had experienced a string of assassinations as well as attacks on the Red Cross and a British envoy’s motorcade. Ambassador J. Christopher Stevens, who was killed in the September attack, e-mailed his superiors in Washington in August alerting them to “a security vacuum” in the city. A week before Mr. Stevens died, the American Embassy warned that Libyan officials had declared a “state of maximum alert” in Benghazi after a car bombing and thwarted bank robbery.

In the closing weeks of the presidential campaign, the circumstances surrounding the attack on the Benghazi compound have emerged as a major political issue, as Republicans, led by their presidential candidate, Mitt Romney, have sought to lay blame for the attack on President Obama, who they argued had insufficiently protected American lives there.