At least 21 people, including two Americans, were killed Friday evening in a commando-style attack by Taliban insurgents on a popular Lebanese restaurant in the Afghan capital, local officials said Saturday.

The attack, one of the deadliest in Kabul in years, began when a suicide bomber blew himself up outside the restaurant gate just after 7 p.m. Friday, according to the Interior Ministry. Gunmen then entered and started shooting in the busy dining room.

After a sporadic exchange of gunfire that lasted nearly two hours, security forces said they had shot dead the two attackers inside.

“The U.S. Embassy has confirmed that at least two private U.S. citizens were among the victims of last night’s terrorist attack in Kabul,” officials said in a tweet Saturday. The pair had been teaching at the private American University of Afghanistan, in Kabul, the embassy said.

State Department spokes­woman Jen Psaki said the dead did not include any members of the U.S. Embassy staff in Kabul.

Hashmat Stanekzai, a spokesman for Kabul’s police command, said police had established that 13 foreigners and eight Afghans were killed in the attack. He said five of the victims were women, four of them expatriates.

A spokesman for the Taliban, Zabiullah Mujahid, asserted responsibility for the attack. In a statement, the Taliban said the assault was to avenge the killings of a group of civilians who died in a U.S. airstrike earlier this week northwest of Kabul.

Among those killed was the owner of the restaurant, Kamal Hamade, Interior Ministry officials said. Four Afghan employees of the United Nations lost their lives, as did the International Monetary Fund’s country director, Wabel Abdallah, who, like Hamade, was Lebanese, news reports said.

The Associated Press reported Saturday that the dead also included a Somali American, two Britons, two Canadians, a Danish police officer, a Russian, a Malaysian and a Pakistani.

It was not clear how many people on the premises survived.

A relative of one of the restaurant employees who managed to escape said he was told that, soon after the attack began, Hamade led some of his Afghan employees to safety.

The target of the attack was La Taverna du Liban, a Lebanese restaurant in the heart of Kabul’s most exclusive and heavily guarded residential district.

For years, the bistro was a rare haven of relaxation for foreign diplomats, aid workers and Afghan officials in a gray city full of blast barriers and beggars. Hookahs bubbled in an alcove equipped with low couches, and Arabic pop music played in the background. Wine and beer were served discreetly, in china teapots, along with savory Lebanese appetizers of kebab, falafel, tabbouleh and stuffed grape leaves.

In the past year, as international missions began to downsize or leave the capital in anticipation of Western troop withdrawals, the number of ­foreigner-friendly establishments shrank, but La Taverna thrived.

On Friday evenings in particular, it was often full and lively, with laughter rising amid a mix of languages. Hamade, the owner, was known for the warmth with which he presided over his domain, fingering prayer beads as he chatted with longtime customers about Middle Eastern politics.

Both the liberal atmosphere and the VIP clientele, however, made the restaurant a natural target for the insurgents, who have attacked numerous international facilities here — from aid compounds to luxury hotels — over the years. It also was subjected to periodic official crackdowns on alcohol, and there was an armed attack by unknown assailants, in which Hamade was injured.

In 2011, the restaurant added armed guards and triple-door steel barricades at its entrance to protect customers and win continued approval from foreign embassies and missions for their employees to eat there.

Those precautions were no match for the suicide team that attacked Friday night.

The attack, coinciding with deadlock over the signing of a long-term bilateral security agreement between Kabul and Washington, drew condemnation worldwide, including from the White House.

“There is no possible justification for this attack, which has killed innocent civilians, including Americans, working every day to help the Afghan people achieve a better future with higher education and economic assistance,” the White House press office said Saturday in a statement.

Afghan President Hamid Karzai also denounced the attack Saturday.

Citing Karzai in a statement, the palace said the campaign against terrorism will succeed when a distinction is drawn between the victims of the war and terrorists, apparently alluding to raids by foreign troops that cause civilian casualties, a main source of friction for years between Karzai and his Western backers.

“In this regard, if NATO and the United States that leads it want to be an ally of and collaborator with the Afghan people, then they should target terrorism,” Karzai was quoted as saying, referring to sanctuaries of the Taliban in Pakistan.

Karzai, who has repeatedly refused to sign the agreement with Washington despite the passing of several U.S. deadlines, again said the United States and Pakistan can play key their roles in ending the Afghan war.

Afghan Interior Minister Omer Daudzai said Friday night’s attack shows that insurgents would want to isolate Afghanistan whether Karzai does or does not sign the agreement, which would extend the U.S. troop presence beyond the end of this year, when the foreign combat mission ends.

Speaking to Afghan and foreign military officers, Daudzai said Karzai is keen to sign the security agreement but wants to establish a framework that bans raids on Afghan villages by U.S. troops and brings peace to Afghanistan.

“The problem cannot be solved through making press statements,” Daudzai said, referring to the deadlock. “Setting a deadline is not efficient. Our request to the United States is to quickly send a high-ranking delegation to sit down for talks and reach a conclusion soon, so that we get out of this disarray.”

Constable reported from Washington. Tim Craig in Islamabad, Pakistan, contributed to this report.