An Afghan security forces member stands guard at the site of a blast in Kabul. Picture: Mohammad Ismail/Reuters

Kabul - Islamic State militants claimed responsibility for a suicide bombing at the entrance to a military university in Kabul city that killed at least six people.

The terrorist group said through its mouthpiece, Amaq news agency, that one of their fighters blew himself up in a crowd of Afghan army soldiers.

Kabul police spokesman Ferdous Faramarz said 16 people were also injured in the attack at the gate of the Marshal Fahim military university in western Kabul. 

"The suicide bomber was identified by security forces but then detonated his explosives," Faramarz said. 

The blast happened while students were leaving the facility, according to a military source who spoke to dpa on condition of anonymity.

Afghan soldiers stand guard at the site of a blast in Kabul, Afghanistan. Picture: Mohammad Ismail/Reuters

The military source gave a higher death toll than Faramarz, saying six policemen and four military students were killed. The source said 13 civilians were injured in the attack.

An Afghan security forces member stands guard at the site of a blast in Kabul, Afghanistan. Picture: Mohammad Ismail/Reuters

The university has been the target of militant groups several times over the years. An Islamic State attack near the university last year left 11 dead and six injured. 

Seven attacks in the Afghan capital city since January this year have left at least 42 people dead and more than 300 injured. 

dpa