The Taliban claimed responsibility for the attack in the southern city of Kandahar that claimed the lives of the provincial governor, intelligence and police chiefs.
The three top officials in Afghanistan's Kandahar province were killed when a gunman posing as a bodygard opened fire on them at a security conference Thursday, the deputy provincial governor said.
A Taliban spokesman claimed responsibility for the attack saying the target was Washington's top general in Afghanistan, Gen. Scott Miller, who escaped without injury, according to NATO.
Agha Lala Dastageri, Kandahar's deputy provincial governor, said powerful provincial police chief Abdul Raziq was among the dead, along with Kandahar Governor Zalmay Wesa, who died of his wounds at a nearby hospital.
Dastageri said provincial intelligence chief Abdul Mohmin also died inside the governor's sprawling residence where the attack occurred.
Three Americans — a service member and two civilian workers — were wounded in the shooting, said US Colonel Knut Peters, a spokesman for NATO troops in Afghanistan. Their conditions were not immediately known.
"Gen. Miller is unhurt," said Peters. Miller is the commander of US and NATO troops in Afghanistan.
Khalid Pashtun, a member of parliament from the province, said Afghan Security Forces cordoned off the area and a US military helicopter circled overhead as a gun battle that began at 3 pm local time raged on for more than one hour.
Peters said initial reports indicated that the attacker was dead. He had no further information.
In a telephone interview, the spokesman for the Taliban in Afghanistan's southern region, Qari Yousuf Ahmadi, said the Taliban carried out the attack. He said Gen. Miller was the target and said Raziq, the governor and the intelligence chief were killed.
Pashtun said an Afghan military corps commander was also among the dead, although he didn't name him.
An Interior Ministry official speaking on condition of anonymity because he was not authorised to speak to the media said Raziq rarely visited the governor's residence and was meticulous about his own security.
Razik was a particularly powerful figure in southern Kandahar and a close US ally despite widespread allegations of corruption. He ruled in Kandahar, the former Taliban heartland, with an iron fist and had survived several attempts to kill him, including one last year that resulted in the death of five diplomats from the United Arab Emirates.
Security has been steadily deteriorating in Afghanistan with increasingly brazen attacks being carried out by insurgents and Afghanistan's security forces have been on high alert ahead of Saturday's elections.
The Taliban have threatened the polls and warned teachers and students not to participate in the vote and not to allow schools to be used as polling centres. The insurgents said in a statement Wednesday that they will target Saturday's elections, which they view as illegitimate, but that they do not want to harm civilians.
Meanwhile, a NATO convoy was attacked late Wednesday near the Afghan capital, killing two civilians and injuring five Czech troops, Afghan officials and the Czech military said Thursday.
The attack, which took place in the district of Bagram in Parwan province, also wounded three Afghan civilians, said Wahida Shakar, spokeswoman for the provincial governor.
Bagram is about 40 kilometres (24 miles) from Kabul and is also the home of a sprawling US military base.
The Taliban claimed responsibility for the attack.
Of the five Czech soldiers, one was seriously injured when their vehicle overturned following the explosion. The soldier underwent surgery and the Czech military said he was not in life-threatening condition.
Earlier, NATO spokeswoman Sgt. 1st Class Debra Richardson had said three alliance service members were hurt in the bombing but didn't provide more details.
Taliban spokesman Zabihullah Mujahid said an insurgent suicide bomber rammed his car into the NATO convoy.
The attack on the NATO convoy came at the end of a particularly violent day across Afghanistan as tensions are rising ahead of the country's parliamentary elections on Saturday.
A Taliban bombing in southern Helmand province killed a candidate running in the elections.
The Taliban also attacked checkpoints in the northern Baghlan province, killing six policemen and wounding two others in a four-hour battle.
Also, in eastern Maidan Wardak province, a suicide car bomber targeted a military vehicle, killing two Afghan army troops.
In recent months, Afghan troops have come under near-daily attacks. NATO troops, which handed over security to Afghan forces at the end of 2014, mostly train and assist with air power.
So far this year, eight US soldiers and three other NATO service members have died in Afghanistan.