By Jessica Donati and Hamid Shalizi

KABUL (Reuters) - The Taliban bombed a British embassy vehicle in the Afghan capital Kabul on Thursday morning, killing five people, and attacked a foreign compound in the city center in the evening, officials and witnesses said.

The suicide attack on the car in the east of the Afghan capital killed two embassy workers, one Briton and one Afghan, and wounded more than 30 others nearby, officials said.

A second blast, at a compound run by a contractor for the U.S. aid agency in Afghanistan, shook buildings in the diplomatic quarter and was followed by an intense hour-long gun battle between insurgents and Afghan security forces.

A foreign national was injured and two suicide bombers were killed in the second attack, which started when a car loaded with explosives detonated outside the compound just after 7 p.m., according to security officials.

Hours later, blasts and gunfire continued sporadically and coalition helicopters flew overhead, assisting with efforts to clear the area of at least one more suicide bomber, according to security sources.

A Western security official said the explosion failed to breach the compound walls, which were well fortified. The area was reported clear by about 1 a.m. on Friday morning, local time.

"There are no casualties among the Afghan security forces," said the commander of 111 Military Corps Kabul, Qadam Shah Shaheem, adding that all compound staff were safe.

Thursday's incidents were the latest in a wave of bombings to hit the city as the majority of foreign combat troops prepare to withdraw from the country by the end of the year.

Taliban insurgents, who were ousted from power by a U.S.-led coalition in 2001, claimed responsibility for both attacks, saying the embassy car bomb "targeted foreign invading forces", while the compound was an "important center of the enemy".

Attacks aimed at foreign diplomats and civilians are less common than the daily strikes against Afghan and international military forces across the country.

Story continues

More than 4,600 Afghan police and army personnel have been killed in the war against the Taliban since the start of the year.

BRITISH CITIZEN KILLED

A Reuters witness saw at least one survivor being led away from the charred shell of the British embassy vehicle by a member of the British security force.

"I am deeply saddened to confirm that a British national civilian security team member and an Afghan national working for the embassy were killed in the incident," Foreign Secretary Philip Hammond said in a statement, adding that another Briton had been injured.

G4S, the world's biggest security firm, later confirmed one of its staff had been killed in the blast and another injured.

"Next of kin have been informed and we will continue to provide them with support," a company spokesperson said.

The Afghan interior ministry initially reported that the blast was caused by a suicide bomber on a motorcycle, but later said the attacker had been in a car.

Since Monday, when two American soldiers were killed in a powerful blast close to the airport, there have been at least five high-profile attacks in Kabul.

Last year a 25-year-old American diplomat was killed in an attack on a convoy in the east of the country, and the U.S. consulate in western Herat province was attacked with a truck bomb. In May, the Indian consulate in the same province was targeted by insurgents with rocket-propelled grenades and suicide vests.

(Additional reporting by Mirwais Harooni in Kabul and Kate Holton in London; Writing by Kay Johnson and Jessica Donati; Editing by Nick Macfie, Mike Collett-White and Andrew Roche)