TRIPOLI, Libya – It began around nightfall on Sept. 11 with about 150 bearded gunmen, some wearing the Afghan-style tunics favored by Islamic militants, sealing off the streets leading to the U.S. Consulate in Benghazi. They set up roadblocks with pickup trucks mounted with heavy machine guns, according to witnesses.

The trucks bore the logo of Ansar al-Shariah, a powerful local group of Islamist militants who worked with the municipal government to manage security in Benghazi, the main city in eastern Libya and birthplace of the uprising last year that ousted Moammar Gadhafi after a 42-year dictatorship.

There was no sign of a spontaneous protest against an American-made movie denigrating Islam’s Prophet Muhammad. But a lawyer passing by the scene said he saw the militants gathering around 20 youths from nearby to chant against the film. Within an hour or so, the assault began, guns blazing as the militants blasted into the compound.

The witness accounts gathered by The Associated Press give a from-the-ground perspective for the sharply partisan debate in the United States over the attack that left U.S. ambassador Chris Stevens and three other Americans dead. They corroborate the conclusion largely reached by American officials that it was a planned militant assault. But they also suggest the militants may have used the film controversy as a cover for the attack.

The ambiguity has helped fuel the election-time bickering in the United States ever since.

The Obama administration has sent out muddled messages about whether it was a planned attack or a mob protest that got out of control. A day after the attack, President Obama referred to “acts of terror.” He told CBS’ “60 Minutes” in an interview aired the following Sunday that he believed those involved “were looking to target Americans from the start.”

Within 24 hours of the attack, both the embassy in Tripoli and the CIA station chief sent word to Washington that it was a planned militant attack. Still, days later, the U.S. ambassador to the U.N., Susan Rice, said the attack began as a spontaneous protest over the film.

Republicans, embroiled in a heated presidential campaign, seized on the confusion. They have accused the Obama administration of being hesitant to call it a “terrorist attack” linked to al-Qaida because that would weaken one of Obama’s key campaign selling points — that under his watch, al-Qaida had been weakened and Osama bin Laden had been killed..

As that debate roiled, the events became somewhat skewed in the mouths of politicians. One assumption is that if the attack was planned, then it must have been linked to al-Qaida.

Ansar al-Shariah is made up of militants with an al-Qaida-like ideology, but it is not clear whether it has any true ties to the terror organization. Made up mainly of veterans of last year’s civil war, it is one of the many powerful, heavily armed militias that operate freely in Libya and in Benghazi, while government control remains weak.

U.S. officials say they are still investigating whether there is an al-Qaida connection. They say members of Ansar al-Shariah called members of al-Qaida’s branch in North Africa outside of Libya and boasted of the attack. But the officials acknowledge the calls alone do not yet prove the branch, known as al-Qaida in the Islamic Maghreb, was involved.

A day after the Benghazi attack, an unidentified Ansar al-Shariah spokesman said the militia was not involved “as an organization” — leaving open the possibility members were involved. He praised the attack as a popular “uprising” sparked by the anti-Islam film, further propagating the image of a mob attack against the consulate.

So far, the attackers’ motives can only be speculated at.

Yasser el-Sirri, a former Egyptian militant who runs the Islamic Observation Center in London closely tracking jihadi groups, said the attack “had nothing to do with the film but it was a coincidence that served the (militants’) purpose.”

He believes the ambassador was the target and the attackers may have been inspired by an al-Qaida call to avenge the death of a top Libyan jihadist on the anniversary of the 9/11 attacks on the United States in 2001. But he offered no firm evidence that was the motive.

The news trickled out slowly the night of the attack, with initial reports overshadowed by the storming of the U.S. Embassy in Cairo by protesters angry over the film. It was only the next morning that Stevens’ death was confirmed.

In the past week, the AP has gathered accounts from five witnesses, including one of the embassy guards and several people living next door to the consulate compound who were present when the militants first moved in.

The neighbors all described the militants setting up checkpoints around the compound around 8 p.m. The State Department’s timeline says the attack itself began around 9:40 p.m.

Khaled al-Haddar, a lawyer who passed by the scene as he headed to his nearby home, said he saw the fighters gathering a few youths from among passers-by and urged them to chant against the film.

“I am certain they had planned to do something like this, I don’t know if it was hours or days, but it was definitely planned,” al-Haddar said. “From the way they set up the checkpoints and gathered people, it was very professional.”

The guard said he saw no protesters. He heard a few shouts of “God is great,” then a barrage of automatic weapons fire and rocket-propelled grenades began, along with barrages from heavy machine guns mounted on trucks.

The attackers set fire to the main consulate building. Stevens and another staffer, caught inside amid the confusion, died of smoke inhalation.

The attack came from the front and the side. A neighbor whose house is on the side of the consulate compound said he saw militants attacking.

Because of the checkpoints, “it felt like our neighborhood was occupied, no one could get out or in,” he said.

The effectiveness of the roadblocks was later revealed in the State Department’s account of the evacuation. It described how the rescue force came under heavy fire and grenade attacks as they tried to leave the consulate area.

They evacuated staffers to a security compound across town, where they continued to come under fire. A precision mortar hit the compound’s building at 4 a.m., killing two other Americans.