WASHINGTON – The Obama administration acknowledged for the first time Wednesday that last week’s assault on the U.S. consulate compound in Benghazi that left the U.S. ambassador to Libya and three other Americans dead was a “terrorist attack” apparently launched by local Islamic militants and foreigners linked to al-Qaida’s leadership or regional allies.

“I would say they were killed in the course of a terrorist attack,” Matthew Olsen, director of the National Counterterrorism Center, told the Senate Committee on Homeland Security and Governmental Affairs.

It was the first time that a senior administration official had said the attack was not the result of a demonstration over an anti-Islam video that has been cited as the spark for protests in dozens of countries over the past week.

Significant questions persist about the consulate’s security: The attack took place on the anniversary of the Sept. 11, 2001, terror attacks on the U.S.; Americans were known to be under threat; and Benghazi had experienced a string of attacks on foreign targets during the summer. Moreover, Libya remains plagued by armed groups nearly a year after the U.S.-backed ouster of the late dictator Moammar Gadhafi. Yet the facility was primarily defended by local guards who may have been complicit.

“We are relying on foreign nationals, perhaps on a British security firm that has been told to be unarmed, and other more questionable and less secure means of protecting our American personnel,” Sen. Susan Collins, R-Maine, said during the hearing. “I’m just stunned and appalled that there wasn’t better security given the high threat environment.”

In Libya, a third top security official quit amid charges that the Interior Ministry — which oversees the security of foreign diplomats — has failed to rebuild national security forces to replace militias formed during the war against Gadhafi, leaving Libya without a functioning army or police service and dependent on Islamist militants for security.

Questions about the consulate’s security — and whether the attack was spontaneous or planned in advance by al-Qaida or an allied group without being detected by U.S. intelligence — are sensitive ones for President Obama. His claims that his policies have made Americans safer and devastated the core of al-Qaida are key planks of his campaign for re-election.

His administration had insisted that the assault was spontaneous and grew from a protest inspired by a demonstration at the U.S. Embassy in Cairo against the online video that denigrates the Prophet Muhammad, the founder of the Islamic faith, and was made in the United States.

The head of Libya’s interim government, key U.S. lawmakers and experts contend that the attack appeared long-planned, complex and well-coordinated, matching descriptions given last week by the consulate’s landlord and a wounded security guard, who denied there was a protest at the time and said the attackers carried the banner of Ansar al-Shariah, an Islamist militia.

The U.S. ambassador to Libya, Christopher Stevens, and an information specialist apparently succumbed to smoke from fires ignited when scores of armed extremists stormed the compound, firing assault rifles, rocket-propelled grenades and mortars. Two U.S. security personnel were shot dead protecting up to 30 other Americans.