KABUL, AFGHANISTAN — The Afghan soldier who killed a U.S. two-star general and wounded other top officers hid in a bathroom before his assault and used a NATO assault rifle in his attack, an Afghan military official said Wednesday.

The investigation into the killing of Maj. Gen. Harold J. Greene, the highest-ranked U.S. officer to be slain in combat since 1970 in the Vietnam War, focused on the Afghan soldier, who went by the single name Rafiqullah, the official said. The shooting wounded about 15 people, including a German general and two Afghan generals, before Rafiqullah was killed, the official told The Associated Press.

However, Rafiqullah's motive for the attack remained unclear Wednesday as American officials prepared to fly Greene's body back to the U.S. and a similar attack saw an Afghan police officer drug and shoot dead seven of his colleagues, authorities said.

Rafiqullah, in his early 20s, joined the Afghan army more than two years ago and came from the country's eastern Paktia province, the Afghan official said. On Tuesday, Rafiqullah just had returned from a patrol around the greater Camp Qargha, west of the Afghan capital, Kabul.

The official said others on patrol with Rafiqullah turned in their NATO-issued assault rifles, but Rafiqullah kept his and hid in a bathroom. Rafiqullah opened fire when the generals walked into view, the official said.

The Afghan official spoke on condition of anonymity as he wasn't authorized to release the information. A second Afghan military official corroborated his account.

About half of the wounded in Tuesday's attack at Marshal Fahim National Defense University were Americans, several of them reported to be in serious condition. However, there was no indication that Greene was specifically targeted.

The Afghan military official said there was no motive yet for Rafiqullah's attack, though he came from a district in Paktia province known to harbor fighters from the Haqqani network, which has strong links to the Taliban and conducts attacks against U.S. forces. There also were indications that Rafiqullah had a dispute with his own superiors before the shooting and opened fire because of it, said a U.S. official who spoke on condition of anonymity to discuss information not yet made public.

In a statement, NATO said Greene's body was being prepared Wednesday to be flown to the U.S. via Dover Air Force Base in Delaware.

"Our thoughts and prayers are with Maj. Gen. Greene's family, and the families of our soldiers who were injured," NATO said. "These soldiers were professionals, committed to the mission."

The German Defense Ministry identified its wounded officer Wednesday as Brig. Gen. Michael Bartscher, saying he was in stable condition at Baghram airfield and that authorities were considering bringing him back home.

The attack underscores the tensions that persist as NATO's combat role winds down in Afghanistan — and it wasn't the only assault by an Afghan ally on coalition forces on Tuesday. In 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.

A third "insider attack" happened late Tuesday in the Uruzgan provincial capital of Tirin Kot, where an Afghan police officer killed seven of his colleagues at a checkpoint, then stole their weapons and fled in a police car, provincial spokesman Doost Mohammad Nayab said.

A doctor at a local hospital told the AP it appeared the police officer drugged his colleagues before the shooting. The doctor spoke on condition of anonymity as he wasn't authorized to release the information. Nayab later denied that the police officers had been drugged and said the officer involved had Taliban connections, without elaborating.

So-called "insider attacks" in Afghanistan rose sharply in 2012, with more than 60 coalition troops — mostly Americans — killed in 40-plus attacks that threatened to shatter all trust between Afghan and allied forces. U.S. commanders imposed a series of precautionary tactics and the number of such attacks declined sharply last year.

Such "insider attacks" are sometimes claimed by the Taliban insurgency as proof of their infiltration. Others are attributed to personal disputes or resentment by Afghans who have soured on the continued international presence in their country more than a dozen years after the fall of the Taliban's ultra-conservative Islamic regime.

Foreign aid workers, contractors, journalists and other civilians in Afghanistan are increasingly becoming targets of violence as well. But despite the approaching foreign troop withdrawal, U.S. Defense Secretary Chuck Hagel said America remained committed to Afghanistan.

"The episode that happened yesterday in Afghanistan is not going to affect our decision or resolve to continue moving forward on an enduring presence post-2014," Hagel said. "When you lose anybody, it's tough."