The pistol used to kill two U.S. airmen at Frankfurt airport jammed with six rounds left, possibly saving the lives of other American troops on their way to Afghanistan, a German investigator said Friday.

Two other U.S. Air Force personnel were wounded in the attack Wednesday by 21-year-old Arid Uka, an ethnic Albanian from Kosovo who had lived in Germany for years.

Uka was formally charged Thursday with two counts of murder and three counts of attempted murder. He refused to speak in court but made lengthy statements to police shortly after the attack, prosecutor Rainer Griesbaum told a news conference.

Uka told authorities he had taken the FN 9mm pistol and two knives to the airport specifically to kill Americans “as revenge for the American mission in Afghanistan,” Griesbaum said.

He said a YouTube video Uka saw the day before the attack, allegedly showing a U.S. raid on a home in Afghanistan, had inspired him to prevent “further cruelties.”

When he saw the busload of 16 airmen parked outside Terminal 2 heading to the nearby Ramstein Air Base, he approached one standing outside and, under the pretext of asking for a cigarette, asked if they were on their way to Afghanistan.

“When he said yes, he shot the 25-year-old serviceman from behind in the head,” Griesbaum said.

Uka then stormed onto the bus, yelling “Allah Akbar!” — Arabic for “God is great!” — and shot the driver in the head, killing him as well, Griesbaum said.

He shot twice at a 25-year-old airman seated on the bus, wounding him, then fired once at a 21-year-old airman, wounding him as well, Griesbaum said.