Image copyright AFP Image caption Afghan security forces keep watch near Bagram

A suicide bomber who killed four people inside the largest US military base in Afghanistan was a former Taliban member working there, the BBC has learned.

Qari Enayatullah joined the peace process in 2008, district governor Haji Abdul Shokor Qudosi told the BBC.

It is not known what job he did at Bagram or how long he had been there. He was among Afghan labourers reporting for duty when he detonated his vest injuring 17 other people.

The Taliban claimed Saturday's attack.

The suspect's home was raided and two of his relatives were detained by Afghan security forces as investigations continue.

The attack was a major security breach in one of the best protected places in Afghanistan.

Bagram has been targeted by militants in the past but this is the first time a bomb has exploded inside the base.

Just north of the capital Kabul, it has been used as the main military base and airfield by the US-led forces and Nato over the past 14 years.

US Defence Secretary Ash Carter said on Saturday two members of the armed services and two contractors were among the dead.

A further 16 US service members and one Polish soldier were injured, he added.

In the wake of the attack, and another on a German Consulate two days earlier, the US Embassy in Afghanistan decided to close its doors on Sunday "as a temporary precautionary measure".