The head of the International Monetary Fund (IMF) in Afghanistan and four UN staff were among as many as 21 people killed when a Taliban suicide squad burst into a Kabul restaurant on Friday evening and gunned down the diners.

Two Britons were among the dead after the unusually violent attack at the heart of the heavily fortified diplomatic quarter.

The Foreign Office named one of the British victims as Dhamender Singh Phangurha.

The Canadian foreign affairs minister, John Baird, said two Canadians died in the attack. Deputy Afghan interior minister Ayoub Salangai said in a tweet that the dead included four women.

The IMF said their country head, Lebanese citizen Wabel Abdallah, had worked in Afghanistan since 2008.

"This is tragic news, and we at the fund are all devastated," managing director Christine Lagarde said in a statement. "Our hearts go out to Wabel's family and friends, as well as the other victims of this attack."

Targeting civilians in a lightly protected restaurant was a clear statement of insurgent intent in a year critical for Afghanistan's future.

Mohammad Zahir, the Kabul police chief, said there were both foreigners and Afghans among the dead and wounded, but declined to give further information.

A Taliban spokesman said on Twitter that the attack was revenge for an airstrike that had killed civilians in Parwan province this week.

The UN secretary-general, Ban Ki-moon, condemned the attack "in the strongest terms", saying "such targeted attacks against civilians are completely unacceptable and are in flagrant breach of international humanitarian law", UN deputy spokesman Farhan Haq said.

In Washington, State Department spokeswoman Jen Psaki said the US condemns "this despicable act of terrorism in the strongest possible terms". She said all US embassy personnel were accounted for.

A presidential election in April will select Afghanistan's first new ruler in more than a decade, and foreign combat troops finish their mission, leaving the Afghan police and army to battle the Taliban alone.

Friday's attack began with a bomb blast that shook the Wazir Akbar Khan neighbourhood shortly after 7pm, as one attacker apparently detonated his explosives at the restaurant's front gate.

It was followed by more than two hours of sporadic gunfire, as Afghan commandos besieged two other attackers who reportedly stole through a back entrance and holed up inside.

"Damn! Never experienced so close an attack. Shootings and screams of horror in the street. Broken windows in our house!" one Afghan who lives near the restaurant posted on Facebook.

The Taliban rapidly claimed responsibility, saying they had targeted "foreign invaders", although the Nato mission said there were no soldiers at the restaurant when the assault began.

The restaurant's popular owner, Lebanese citizen Kamal Hamade, was among the dead. "VV sad news Kabul. Our dear Lebanese friend Kamal, the kindest of hosts, was killed in Taliban attack," BBC journalist Lyse Doucet said on Twitter.

The UN boss in Afghanistan, Jan Kubis, condemned the attack and targeting of civilians. "This violence is unacceptable and must stop immediately," he said in a statement.

It was the deadliest day for the UN in Afghanistan in nearly three years.

In April 2011 a rioting mob overran a compound in northern Mazar-e-Sharif city, killing three UN workers and four Nepalese security guards. Eighteen months earlier, in autumn 2009, five UN workers were killed in Kabul when gunmen burst into a guesthouse for the organisation's staff.

The deaths had a far-reaching impact on how the UN and many other international organisations worked in the Afghan capital.

Although there are regular attacks on targets in the Afghan capital, it is rare for would-be attackers to make it through rings of security around the city, elude an extensive intelligence network, and strike at a civilian target around the unofficial "green zone" that houses Nato and US embassy headquarters.

A single suicide attacker killed an Afghan family, including a human rights chief, with a bomb at a nearby supermarket three years ago, but security has been tightened since then at most places frequented by the Afghan elite or foreigners.

Friday's target, the Taverna restaurant, was a low-key but well-loved venue usually busy on a Friday, the Afghan weekend. It had guards with AK-47s and an air-lock entry system of steel gates, but those precautions would have been little match for a heavily armed suicide squad.

The area is packed with the homes of the Afghan elite, guesthouses for foreigners and offices of international organisations. Many streets are patrolled by police guards, but a well-prepared group could weave through back streets and avoid them.

Afghan families missing loved ones gathered outside the restaurant hoping for news. Ajmal was looking for his father Mohammad Ali, an employee of a telecoms firm.

"My dad called home this afternoon and said 'you guys have your dinner without me, because I am going to a restaurant with my friends'," said Ajmal. He saw a friend of his father carried out injured. "His friend was seriously wounded in his leg. My father has disappeared and we are very worried."