U.S. intelligence agencies have determined that the attack on the U.S. mission in Libya involved a small number of militants with ties to al-Qaeda in North Africa but see no indication that the terrorist group directed the assault, U.S. officials said Thursday.

The determination reflects an emerging consensus among analysts at the CIA and other agencies that has contributed to a shift among senior Obama administration officials toward describing the siege of U.S. facilities in Benghazi as a terrorist attack.

U.S. intelligence officials said the composition of the militant forces involved in the assault has become clearer over the past week and that analysts now think that two or three fighters affiliated with al-Qaeda in the Islamic Maghreb were involved.

“There are people who at least have some association with AQIM,” said a senior U.S. intelligence official who added that “it’s not so direct that you would say AQIM as an organization planned and carried this out.”

Instead, U.S. officials said a ­lesser-known Islamist group, ­Ansar al-Sharia, played a much larger role in sending fighters and providing weapons for the attack, which killed the U.S. ambassador and three other Americans. U.S. officials have previously cited suspicion of al-Qaeda connections to the attack.

The intelligence picture assembled so far indicates that militants had been preparing an assault on the U.S. compound in Benghazi for weeks but were so disorganized that, after the battle started, they had to send fighters to retrieve heavier weapons.

U.S. intelligence officials said they think the attack was not timed to coincide with the Sept. 11, 2001, anniversary. Instead, the officials said, the assault was set in motion after protesters scaled the walls of the U.S. Embassy in Cairo as part of a protest of an amateur anti-Islamic YouTube video.

“There’s never been any intelligence, nor any I’m aware of now, that indicated this was a plot planned months in advance to get turned on on 9/11,” said an Obama administration official.

The emerging scenario, the official said, “is that extremists in the region had cased out and hoped to target U.S. facilities in Benghazi for some time. When they saw what was happening in Cairo, that influenced their timing.”

The officials spoke on the condition of anonymity to describe the preliminary assessments of analysts involved in an ongoing investigation of the Benghazi attack that involves the FBI, the CIA and other agencies.

The question of whether the attack was a pre-planned act of terrorism has become entangled in the politics of the ongoing presidential campaign. Republicans have accused the administration of being reluctant to attribute the Benghazi assault to terrorism, suggesting it could make Obama vulnerable on a perceived foreign policy strength — the success of the campaign against al-Qaeda — and raise questions about his handling of the rise of Islamist factions in the aftermath of the Arab Spring.

The State Department said Thursday that it was pulling more American staff from the U.S. Embassy in Tripoli out of concern for their safety. A State Department official described the reduction as temporary and said the embassy was not being closed. The State Department would not say how many people are leaving or how many will stay.

A message on the embassy Web site Thursday told U.S. citizens in Libya to avoid areas of the city where protests are planned and warned that “even demonstrations that are meant to be peaceful can turn violent and unpredictable. You should avoid them if at all possible.”

After Obama administration officials initially characterized the assault as a protest that turned violent, Secretary of State Hillary Rodham Clinton on Wednesday became the highest-ranking official to call the attack an act of terrorism. In remarks at the United Nations, Clinton said that terrorists were “working with other violent extremists to undermine the democratic transitions underway in North Africa, as we tragically saw in Benghazi.”

Clinton and others had avoided that term until the director of the National Counterterrorism Center, Matthew Olsen, testified before Congress last week that the ambassador and others “died as a result of a terrorist attack.”

At the time, Olsen said that analysts were examining “indications that individuals involved in the attack may have had connections to al-Qaeda or al-Qaeda’s affiliates.”

U.S analysts have combed through intercepted communications, pictures and video from the scene and information from sources, including suspects taken into custody by the Libyan government.

Describing the militants involved, one U.S. official said: “Those individuals — whoever they may be — who took part in the attack all swim in the same, relatively small, extremist pond. So there could be a number of individual or ad hoc ties with AQIM or other extremist groups. These connections alone do not mean AQIM was behind or planned the attack. This is why there’s an ongoing investigation, to identify the attackers and determine motives and relationships to extremist groups.”

Two other U.S. officials said that intelligence indicates that the AQIM figures may have included one or more from outside Libya but declined to provide more details. AQIM, which grew out of a long-standing insurgency in Algeria, has mainly been a regional menace, but it is a source of growing concern to U.S. counterterrorism officials largely because it has acquired territory and weapons in northern Mali.

Beyond the suspicions of al-Qaeda involvement, the key questions surrounding Benghazi so far have centered on the extent to which the assault was premeditated. The staging of the attack, which targeted two separate U.S. compounds, is seen by analysts as evidence of significant pre-planning. But officials said the fighters needed to rearm and that mortars didn’t appear until seven hours into the fight, indicating impromptu adjustments.

“They had to rally people to get their most lethal weapons,” the administration official said.