Three top Kandahar province officials have been killed by their own guards in an attack at a security meeting that also wounded three U.S. troops, Afghan officials say.

A Taliban spokesperson who claimed responsibility for the attack tells The Associated Press that U.S. Gen. Scott Miller, commander of U.S. and NATO troops in Afghanistan, was the target but escaped unharmed.

Agha Lala Dastageri, Kandahar's deputy provincial governor, said Gen. Abdul Raziq, a powerful provincial police chief, and intelligence chief Abdul Mohmin died immediately in the attack, and Zalmay Wesa, the province's governor, died in hospital.

NATO spokesperson Colonel Knut Peters said Miller, who took command of U.S. and forces and the NATO-led Resolute Support mission in Afghanistan last month, was uninjured. Three Americans were wounded in the crossfire, according to a tweet from Resolute Support.

At Kandahar palace today: Afghan-on-Afghan incident, as initial reports indicate. 3 Americans wounded. Gen. Miller uninjured, attacker reportedly dead. —@ResoluteSupport

The security meeting inside the sprawling provincial governor's residence was being held ahead of Saturday's parliamentary elections.

The Taliban claimed responsibility for the attack, saying they had targeted both Miller and Raziq, who had a fearsome reputation as a ruthless opponent of the insurgents.

"This attack will not change U.S. resolve in our South Asia strategy. If anything it makes us more resolute," Lt.-Col. Kone Faulkner, a Pentagon spokesperson, told Reuters.

The attack was a devastating blow to the Afghan government ahead of parliamentary elections on Saturday, which the Taliban have vowed to disrupt.

"The brutal police chief of Kandahar has been killed along with several other officials," a Taliban statement said.

Raziq was criticized by human rights groups but highly respected by U.S. officers who saw him as one of Afghanistan's most effective leaders, largely responsible for keeping Kandahar province under control.

A flamboyant commander, he had survived several attempts on his life over many years and narrowly escaped an attack last year in which five diplomats from the United Arab Emirates were killed in Kandahar.

Officials said one of the governor's bodyguards opened fire on Raziq as he came out of the meeting with Miller and other officials, severely wounding him and several other senior officials including the governor.

"Provincial officials including the governor, the police chief and other officials were accompanying the foreign guests to the plane when the gunshots happened," said Said Jan Khakrezwal, head of the provincial council.