Media playback is unsupported on your device Media caption The BBC's Bilal Sarwary says the attack "will shatter the confidence of the Afghan people"

A suicide bomb attack on the Afghan defence ministry in Kabul has killed at least nine people, as the new US Pentagon chief visited the city.

A further 20 people were wounded by the bomber, who was on a bicycle, security officials told BBC News.

Taliban insurgents said they were behind the attack.

Reports are coming in of a separate suicide bomb attack, near the city of Khost, in which eight children and a policeman are said to have been killed.

At the time of the Kabul blast, US Defence Secretary Chuck Hagel was in a briefing at a US-led military facility elsewhere in Kabul.

Kabul police chief Mohammad Zahir told the BBC ambulances had taken the injured to several hospitals and that the situation was under control.

The new head of the US defence department has arrived at a markedly tense point in the US-Afghan relationship Chuck Hagel in Afghan trip

Two of the wounded were Afghan army soldiers while all of the dead and other injured were civilians, an Afghan defence official told BBC News.

One woman was among those killed.

The attacker struck just before 09:00 (04:30 GMT), about 30m (yds) from the main gate of the ministry.

A man at the scene, Abdul Ghafoor, said the blast had rocked the entire area.

"I saw [dead] bodies and wounded victims lying everywhere,'' he told the Associated Press news agency.

"Then random shooting started and we escaped from the area."

Image caption US Defence Secretary Chuck Hagel was in Kabul on a surprise visit

In an email, the Taliban said it had carried out the attack and had targeted one of the entrances used by soldiers and officers.

"The attack happened during the trip of the US defence secretary, and the attack had a message for him," the statement added.

Earlier, Mr Hagel, who became defence secretary last week, told reporters travelling with him he wanted to see for himself "where we are in Afghanistan".

"I need to better understand what's going on," he said.

There are currently about 66,000 US military personal in the country and early next year that figure will drop to 34,000.

The question of how many international troops will remain after 2014 is still unknown.

'Boys killed'

Saturday's other reported attack occurred outside Khost, a city 150km (93 miles) south-east of Kabul.

A policeman spotted the suicide bomber, who was on foot, as he prepared to attack a joint patrol close to the US military's Camp Salerno base, a police spokesman told BBC News.

The policeman hugged the attacker to himself in an attempt to save lives, Khost deputy police chief Mohammad Yaqub Mandozay said.

However, boys aged 12 to 14 who were working in nearby fields were caught in the explosion,

The region around Khost has been a stronghold of the Haqqani militant network, which has launched deadly attacks on Afghan and international forces, the BBC's Bilal Sarwary reports.