A top Afghan security commander, Kandahar police chief Gen Abdul Raziq, has been shot dead by a bodyguard.
Taliban militants claimed the attack after a high-level meeting inside the governor's compound, saying they had targeted Gen Raziq and top US commander Gen Scott Miller, who escaped.
The local intelligence head was also killed and the governor was critically injured. Three Americans were hurt.
The attack in Kandahar city comes ahead of elections on Saturday.
In a statement, the Taliban referred to Gen Raziq as a "brutal police chief". It said it had targeted both him and Gen Miller, but the Pentagon denied that the US commander was among the key targets.
Initial reports said the attacker was killed in an ensuing shoot-out.
The assassination is seen as a hugely significant victory for the Taliban and a major blow to the Afghan and US counter-insurgency campaign.
It is the first time since the 2001 US-led military intervention that the top commander of US/Nato forces has been involved in such an incident.
US Defense Secretary Jim Mattis said the attack would not affect the US military's movements in Afghanistan.
Afghan and international security officials said Gen Raziq was shot in the back as he left the meeting and walked towards an area where the helicopter taking the US group back to Kabul was coming in to land.
"Provincial officials including the governor, the police chief and other officials were accompanying the foreign guests when the gunshots happened," said Jan Khakrezwal, head of the Kandahar provincial council.
There are reports that the local army commander also died. Local officials suggested that Gen Miller appeared to have been saved by his body armour. The US military only said that he was uninjured.
At least two hand grenade explosions were also reported.
Gen Miller paid tribute to Gen Raziq, saying he had "lost a great friend".
"Today I lost a great friend LTG Raziq. We had served together for many years. Afghanistan lost a patriot, my condolences to the people of Afghanistan. The good he did for Afghanistan and the Afghan people cannotbe undone. " - Gen. Scott Miller— Resolute Support (@ResoluteSupport) October 18, 2018
Gen Raziq has long been accused of human rights abuses, including torture. But he was a powerful opponent of the Taliban in their southern heartland and was credited with securing Kandahar.
Loss of a powerful Taliban opponent
By Dawood Azami, BBC World Service
This is one of the most important security incidents of the past 17 years - in which nearly the entire leadership of a province has been eliminated.
While Gen Raziq, 40, was the provincial police commander of Kandahar, his influence went beyond his native province. Over the past few years, he had emerged as one of the most powerful military and political figures in Afghanistan.
He was considered as one of the strongest opponents of the Taliban and Pakistan and had transformed himself into a symbol of the anti-Taliban struggle in Afghanistan. He had previously survived nearly 20 attempts on his life.
In the absence of such experienced and die-hard figures, the Taliban could mount a campaign to increase their territorial control as the loss of an important leader opens a window of opportunity for the militants.
Where does this leave the election?
Afghan officials had warned that attacks ahead of the parliamentary election were likely. The Taliban has warned voters not to take part in what they say is a ballot imposed by foreigners.
Some expressed fears that Gen Raziq's death could keep voters away from polling stations.
"Gen Raziq's death will have a huge impact on security and the election in the south because a lot of voters may not feel safe to go to vote," a senior security official told Reuters.
The vote is the third parliamentary election to be held since the Taliban were removed from power in 2001.
At least 10 candidates have been killed in attacks around the country in the run-up to the vote. There have also been attacks on voter registration centres, including one in April which killed nearly 60 people.
The vote is being seen as a test of political reforms undertaken by the Afghan government as well as its ability to organise a free and fair vote.
It comes ahead of the all-important presidential elections due in April 2019.
What about US forces in Afghanistan?
American combat operations against the Taliban officially ended in 2014, but over 8,000 US special forces remained in the country backing and providing training and assistance to Afghan troops.
Last year, US President Donald Trump signalled he would keep US boots on the ground indefinitely amid concerns that the Taliban was gaining ground.
The US forces are part of the Nato-led Resolute Support Mission in Afghanistan, which has more than 16,000 personnel.