Greene was a two star major general and the highest ranking official to have been killed in the Afghanistan war. He was deployed to Afghanistan in January, according to the Pentagon's website.

The Taliban claimed responsibility for the attack, in which a gunman wearing an Afghan army uniform opened fire on Americans and others Afghans at Camp Qargha, a military academy 11 miles west of Kabul. The camp trains hundreds of Afghan forces a month and was recently renamed the Marshal Fahim National Defense University for the country's deceased vice president.

Fifteen others were injured, including eight Americans, all of whom are expected to live. Among the injured was a German brigadier general and two Afghan generals, the Associated Press reported.

PHOTO: Afghanistan National Army soldiers stand guard at a gate of Camp Qargha, west of Kabul, Afghanistan, Aug. 5, 2014.

The other wounded included Germans.

Rear Admiral John Kirby said the shooter was believed to be an Afghan soldier.

Today's shooting is the latest in a string of so-called "green-on-blue" attacks in Afghanistan, in which members of the Afghan forces have attacked U.S. and coalition forces. There have been more than 85 green-on-blue attacks during the war, though they have become less frequent this year as fewer U.S. troops have been on the ground in Afghanistan.

Wakil Kohsar/AFP/Getty Images

PHOTO: General view of a military academy base after an Afghan soldier opened fire on NATO troops inside the premises, on the outskirts of Kabul, Aug. 5, 2014.

Afghan President Hamid Karzai condemned the attack and noted that both Afghan and foreign soldiers were hurt.

"The soldiers were visiting the military academy to help with the buildup of Afghan security forces," Karzai said. He blamed the attack on "enemies who don't want to see Afghanistan have strong institutions."

"We are in the process of assessing the situation," the ISAF Joint Command said in a statement. "More information will be released as we sort out the facts."

Get real-time updates as this story unfolds. To start, just "star" this story in ABC News' phone app. Download ABC News for iPhone here or ABC News for Android here.