An American major general has been shot to death in one of the bloodiest insider attacks of the long Afghanistan war when a gunman dressed as an Afghan soldier turned on allied troops, wounding about 15 including a German general and two Afghan generals. The Army identified the American officer as Maj. Gen. Harold J. Greene, a 34-year veteran. An engineer by training, Greene was on his first deployment to a war zone and was involved in preparing Afghan forces for the time when US-coalition troops leave at the end of this year. He was the deputy commanding general, Combined Security Transition Command-Afghanistan. Greene was the highest-ranked American officer killed in combat in the nation's post-9/11 wars in Iraq and Afghanistan and the highest-ranked officer killed in combat since 1970 in the Vietnam War. Five major generals were killed in Vietnam, the last Maj. Gen. John Albert Dillard, whose helicopter was shot down. The attack at Marshal Fahim National Defense University underscored the tensions that persist as the US combat role winds down in Afghanistan — and it wasn't the only assault by an Afghan ally on coalition forces on Tuesday. In eastern Paktia province, an Afghan police guard exchanged fire with NATO troops near the governor's office, provincial police said. The guard was killed in the gunfight. It wasn't clear if the two incidents were linked, and police said they were investigating. Early indications suggested the Afghan gunman who killed the American general was inside a building and fired indiscriminately from a window at the people gathered outside, the US official said. The wounded included a German brigadier general and two Afghan generals, officials said. One of the officials said that of the estimated 15 wounded, about half were Americans, several of them in serious condition. US officials still asserted confidence in their partnership with the Afghan military, which appears to be holding its own against the Taliban but will soon be operating independently once most US-led coalition forces leave at the end of the year.