During a high-profile visit by US Defense Secretary Jim Mattis

At least a dozen Afghan security forces were killed when a suicide attacker driving an explosives-packed Humvee blew himself up in the southern province of Kandahar, police said Thursday.

The Taliban claimed the deadly assault on the government and police headquarters in Maroof district that also wounded several others.

"Twelve security forces were killed and four others were wounded," Kandahar police spokesman Zia Durrani told AFP.

Durrani said the Taliban attackers had been "defeated".

A border police commander in Maroof, which borders Pakistan, gave a slightly higher toll, telling AFP that 14 security personnel had been killed and eight wounded in the attack that happened late Wednesday. 

"The intensity of the blast caused damage to the building and led to casualties," he said.

"The clean-up operation is under way in the area."

The attack is the latest deadly assault by the Taliban, which has been on the offensive since US-led NATO combat troops withdrew in 2014 and now controls swathes of territory across the country. 

During a high-profile visit by US Defense Secretary Jim Mattis and NATO chief Jens Stoltenberg to the Afghan capital Kabul on Wednesday, insurgents launched a volley of rockets near the city's international airport.

A US airstrike launched in support of Afghan security forces who had confronted the attackers caused "several casualties" when a missile malfunctioned. 

One person was killed and 11 others wounded in the assault that lasted several hours, according to the interior ministry.