* Taliban claims responsibility, says revenge killing
* Police say up to 21 dead, mostly foreigners
* Dead include U.S. citizens, two Britons, two Canadians
* Restaurant popular among expatriates in Afghan capital (Adds fresh details of victims, Karzai's statement)
By Jessica Donati and Mirwais Harooni
KABUL, Jan 18 (Reuters) - A Taliban suicide bomber and gunmen attacked a restaurant popular with foreigners in the Afghan capital, killing up to 21 people including three United Nations staff and the IMF's top representative in Afghanistan.
Gunmen burst into the restaurant spraying diners with bullets after the bomber blew himself up near the entrance around 7.30 p.m. on Friday evening.
Thirteen foreigners were among those killed, according to police, and details of the victims began to trickle through on Saturday.
The U.S. embassy said in a post on Twitter that at least two U.S. private citizens were killed. Britain and Canada confirmed they had each lost two nationals, and Denmark said one of its citizens also died.
After the initial blast, sporadic bursts of gunfire were heard over the next hour. The two gunmen inside the Lebanese restaurant, located in Kabul's diplomatic enclave, were shot dead by police, an Afghan official said.
Most foreign forces are preparing to leave Afghanistan this year after more than a decade of war, and there are fears that the Taliban will intensify attacks in the run up to an election in April to find a successor to President Hamid Karzai.
At odds with Washington over the terms, Karzai is still deliberating whether to allow some U.S. troops to stay on. If no agreement is reached, Afghan forces could be left to fight the insurgents on their own.
The Taliban claimed responsibility for Friday's attack, calling it revenge for a U.S. airstrike earlier this week that had also drawn condemnation from Karzai as eight civilians were killed.
Several kitchen staff survived by fleeing to the roof, where they hid until they were rescued by police.
"When I was in the kitchen, I heard an explosion outside. Then all the guys escaped up and I went to the roof and stayed with my back to the chimney for two or three hours," said Suleiman, a cook at the Lebanese restaurant.
By midnight, a clearance operation was still underway, with police nervously flashing lasers at passing cars and people on the dark, dusty streets.
The restaurant had been running for several years, and was a favourite haunt for foreigners, including diplomats, contractors, journalists and aid workers.
A couple of armed guards were usually on duty at the front entrance, which led to a courtyard in front of the main ground floor dining room.
The suicide bomb attack took place at the front entrance, but accounts differed over where the gunmen had entered from.
"The target of the attack was a restaurant frequented by high ranking foreigners... where the invaders used to dine with booze and liquor in the plenty," Taliban spokesman Zabihullah Mujahid said in an e-mailed statement, written in English.
UN PEACE SEEKER KILLED
Karzai issued a statement on Saturday condemning the attack, using the opportunity to swipe at the United States for not doing enough to fight "terrorism".
"If NATO forces led by the United States of America want to be united and partner with the Afghan people, they have to target terrorism," he said in a statement. Karzai is upset with Washington, believing it could do more to persuade the Taliban to begin direct peace talks with his government.
The International Monetary Fund's (IMF) representative in Afghanistan, 60-year-old Lebanese national Wabel Abdallah, was one of the diners killed. He had been leading the Fund's office in Kabul 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."
The U.N. initially said four staff were killed, but had counted the IMF's representative in the total. The three included a Russian, an American and a Pakistani.
The Russian was the senior U.N. political officer in trying to negotiate a start to peace talks with the Taliban.
"You can imagine the effect it has had on staff members here," U.N. spokesman Ari Gaitanis told Reuters.
A British Foreign Office spokeswoman said two Britons were killed in the attack. Del Singh, a British Labour Party candidate for the European Parliament was one of British victims, the other was serving with the EU Police Mission in Afghanistan. A Dane serving with the mission also died.
Canadian Foreign Affairs Minister John Baird said two Canadians were killed, but it was unclear which organisation they worked for.
While the U.S. embassy Twitter post specified the dead Americans were private citizens, State Department spokeswoman Jen Psaki said none of the dead included embassy staff.
Foreign casualties were taken to a military base in Kabul. At a hospital morgue near the attack, Afghans screamed and cried as they mourned attack victims, some pressing scarves to their faces to stifle sobs. One young man, grieving for his dead father, kicked a wall and howled.
"One of the restaurant's cooks was wounded," said a doctor, Abdul Bashir. "Two dead bodies have been taken to the morgue."
While the south and south east of Aghanistan have been the main theatres of action in a war that has dragged on for more than a decade, Kabul has suffered regular attacks.
Taliban fighters mounted several attacks in the capital during the summer months last year, but the assault on Friday inflicted far higher casualties.
With attacks still happening daily, Afghanistan and the United States are struggling to agree on a bilateral security pact, raising the prospect that Washington may yet pull out all of its troops this year unless differences are ironed out.
(Writing by Maria Golovnina; Additional reporting by Erik Kirschbaum in Berlin; Louis Charbonneau in New York; and Anna Yukhananov and Lesley Wroughton in Washington; Editing by Gareth Jones, Amanda Kwan, Lisa Shumaker, Clarence Fernandez and Simon Cameron-Moore)
Our Standards: The Thomson Reuters Trust Principles.