The US Defense Department also identified the assailant as an Afghan soldier and said that he was killed in turn after he opened fire on coalition forces, his supposed allies.
In a condolence message, the military identified the deceased as Major General Harold J. Greene, who was the deputy for acquisitions at the US Army headquarters in Washington.
"Our thoughts and prayers are with Major General Harold J. Greenes family, and the families of our soldiers who were injured today in the tragic events," said army chief General Ray Odierno.
"We remain committed to our mission in Afghanistan and will continue to work with our Afghan partners to ensure the safety and security of all coalition soldiers and civilians," he said.
Greenes official biography said the New York State native held a doctorate in materials science from the University of Southern California as well as three masters degrees.
The general was the highest-ranking US officer killed since the September 11, 2001 attacks, when Lieutenant General Timothy Joseph Maude was killed by a hijacked airliner that crashed into the Pentagon.
No US general has been killed in combat since the Vietnam War, with top-ranking service members spared during the Iraq war and, until now, the Afghanistan conflict. President Barack Obama plans to withdraw most troops from Afghanistan later this year.
A US official, speaking to AFP on condition of anonymity, said that around 15 people were injured including eight Americans.
The nationalities of the other victims were unclear, but the German army said that one of its generals was wounded and the US official said that the injured included Afghans.
The Pentagon spokesman, Rear Admiral John Kirby, said that the assailant was killed, although he did not have more detail on how the incident unfolded.
"We believe that the assailant was an Afghan soldier," Kirby told reporters.
Kirby said it was too early to assess whether US forces need to improve vetting of Afghan troops. But he described the attack as an isolated incident and credited Afghan troops for their work in securing national elections.
"Ive seen no indication theres a degradation of trust between coalition members and their Afghan counterparts," Kirby said.
"Its impossible to eliminate -- completely eliminate -- that threat, I think, particularly in a place like Afghanistan, but you can work hard to mitigate it," Kirby said of insider attacks.
"As terrible as today is -- and it is a terrible day, a terrible tragedy -- we havent seen in the course of the last year or so... a spate of these insider threat attacks. I think thats testament to the good work authorities have done," he said, inresponse to a question.