The Afghan Taliban killed a Supreme Court official, a dozen mine clearers and several national and foreign soldiers, but also suffered heavy losses during intensifying violence ahead of the withdrawal of most international troops in the next two weeks.

In Kabul yesterday, a bomb ripped through a bus carrying soldiers, killing at least seven of them, mangling the vehicle and sending a column of black smoke over the capital.

"A suicide bomber on foot ­detonated his explosives at the door of a bus carrying army soldiers," said Hashmat Stanekzai, a spokesman for the Kabul police chief.

Earlier, gunmen shot dead senior Supreme Court official Atiqullah Raoufi as he left his home in the city.

The Taliban claimed responsibility, but did not say why it had killed him. However, the hardline Islamist insurgents run their own courts in parts of the country and consider the official judiciary to be corrupt.

Heavily fortified Kabul has seen multiple attacks in recent weeks, including several on army buses and a suicide bomb that killed a German citizen in a French cultural centre during a performance of a play that denounced suicide attacks.

Fatalities and injuries among Afghan security forces and civilians peaked this year at the highest point since the US-led war began in 2001, as foreign forces rapidly withdrew most of their troops from the interior of the mountainous nation.

About 5000 Afghan police officers and soldiers have been killed, and more than 1500 civilians died in the first half of the year. A rump of about 13,000 foreign soldiers will remain in Afghanistan next year, down from a peak of more than 130,000.

Fighting has extended long beyond the traditional summer season, with the Afghan government also inflicting heavy casualties on the Taliban. The army and police have said they killed more than 50 militants nationwide in the past 48 hours.

The Taliban have been fighting a guerrilla war ever since their five-year regime was toppled. They now have a strong presence in most of the provinces surrounding Kabul.

Just outside the city and close to the US-run Bagram airfield, the Taliban detonated a roadside bomb on Friday night, hitting a convoy of foreign troops and killing two American soldiers.

The blast left a 10ft-long blackened fissure in the road, a witness said. Helicopters buzzed overhead yesterday morning.

A coalition press release yesterday stated: "Two International Security Assistance Force service members died as a result of an enemy forces attack in eastern Afghanistan on December 12."

The coalition, as is usual, declined to give the soldiers' ­nationality. However, a US defence official based in Washington DC confirmed that the two soldiers killed were Americans.

The Bagram attack came two days after the US closed a prison that had held foreign detainees on the airfield, which is in Parwan province - the only province adjacent to the capital that is usually relatively peaceful.

It also followed a Nato airstrike on Thursday that killed five people in the same province. Afghan officials said the casualties were civilians. The coalition said it was ­investigating the allegations, but added they were identified from the air as militants before the "precision" strike.