PESHAWAR, Pakistan — The top U.S. and NATO commander in Afghanistan, Gen. Scott Miller, escaped injury during a Taliban-claimed gun attack Thursday, but three Americans were wounded.

The police chief of the southern province of Kandahar, Gen. Abdul Raziq, was killed.

Gen. Abdul Raziq, police chief of Kandahar. JAWED TANVEER / AFP - Getty Images

A senior official said Raziq was shot in the back by one of the Kandahar governor’s own elite guards following a high-level security meeting at the governor’s compound.

Col. Knut Peters, a Resolute Support spokesman, said the shooter was reportedly dead.

"There was a situation at the Kandahar palace today," he said. "Initial reports indicate this was an Afghan-on-Afghan incident.”

Peters added: “Gen. Miller is uninjured. We are being told the area is secure. Initial reports also say the attacker is dead. We don’t have any more details at this time.”

While Kandahar Governor Zalmai Wesa was initially reported to have been killed in the attack, later officials clarified he was wounded and undergoing an operation. Afghan lawmaker Khalid Pashton said the regional intelligence chief, Momin Khan, was also killed.

Gen. Scott Miller Massoud Hossaini / AP

Taliban spokesman Qari Yousaf Ahmadi claimed responsibility for attack, telling NBC News that Gen. Miller had been one of the intended targets.

"Actually we planned this attack to kill U.S. military commander and his team members," he said.

Taliban also released a Pashto-language statement claiming responsibility. The three wounded Americans were an armed forces member, a civilian and a contractor.

Raziq, one of the country’s top police chiefs, had survived 29 previous attempts to kill him.

Said Jan Khakrezwal, the head of the Kandahar provincial council, said the governor, Raziq and other officials were escorting the U.S. visitors to their plane when the gunfire began.

Afghanistan Army Chief of Staff Gen. Mohammad Sharif Yaftali said at a press conference that the attack occurred as the group was leaving towards a helipad and that the gunman's "first target was General Abdul Raziq," according to the Associated Press.

A Taliban commander told NBC News that they believed if they killed Miller President Donald Trump would have withdrawn U.S. forces from Afghanistan, but that the group considered the killing of Raziq to be a "major success."

Gen. Miller, in a statement tweeted by Resolute Support, expressed his condolences to the people of Afghanistan.

"Today I lost a great friend LTG Raziq. We had served together for many years," Miller said. "Afghanistan lost a patriot, my condolences to the people of Afghanistan. The good he did for Afghanistan and the Afghan people cannot be undone."

Mushtaq Yusufzai reported from Peshawar, Pakistan; Hans Nichols from Washington; Ahmed Mengli from Kabul, Afghanistan; and Alastair Jamieson from London.

CORRECTION (Oct 18, 2018, 12:15 p.m. ET): A previous version of this article misstated how many members of the American armed forces were wounded in the attack. It was one; two other Americans who were wounded were a civilian and a contractor.