FRANKFURT — Arid Uka, the 21-year-old man suspected of killing two American airmen this week, has told investigators that he was seeking revenge for the deployment of Americans in Afghanistan after watching radical Islamist videos on the Internet, German authorities said Friday.

Prosecutors say that Mr. Uka, who is also accused of wounding two others in the attack on an American military bus at Frankfurt airport on Wednesday, had tried to kill more servicemen but failed to do so only because his gun jammed.

“The bus was waiting at the terminal, and one serviceman after the other got on it,” said a German security official, who was not authorized to speak publicly . Mr. Uka asked the last one for a cigarette, “then he asked the soldier if they were heading to Afghanistan.”

When the serviceman answered yes, the official said, Mr. Uka shot him with a handgun in the back of the head.