Taliban insurgents have stormed a prison in Afghanistan, killing police and releasing more than 350 inmates, including nearly 150 deemed a threat to national security, and then attacked troops rushing to help.

The latest Taliban prison raid, on the outskirts of the central city of Ghazni, comes after setbacks for the government in different parts of the country and deadly attacks in Kabul which have dashed hopes for peace talks.

Eyewitnesses outside the mud fort prison in Ghazni, 75 miles southwest of the capital Kabul, saw the bodies of two men who appeared to be suicide bombers and a blown-up car that had apparently been used to destroy the main entrance.

Clusters of bullet casings were scattered across the road.

The interior ministry said that 350 of the 436 prisoners had escaped.

Of those who got away, 148 were a "threat to national security and 207 were criminals", the ministry said.

Four Taliban and four members of the security forces were killed in the attack and seven police were injured.