AMMAN, Jordan — At least five people, including two American trainers, were killed on Monday at an Amman training compound by a Jordanian police officer who fired on them before he was shot to death, the government said.

The shooting in the Jordanian capital immediately raised concerns of a possible infiltration of the training program by anti-American militants. Jordan, a United States ally, has been involved in the American-led aerial bombing campaign against Islamic State targets in neighboring Syria and Iraq for the past year.

Jordanian and American officials said it was premature to speculate on the motive of the gunman, who was identified in official statements only as a Jordanian police officer.

The Jordan Times newspaper quoted an unidentified relative of the assailant as saying he was Anwar Abu Zaid, a 28-year-old police captain and university graduate who was married with two children and was from the northern Jordanian village of Rimoun. The newspaper said residents were in “complete shock” over the shootings and described the assailant as “a very kind person, who is religious but moderate.”