A Jordanian policeman opened fire Monday on foreign trainers at a police compound, killing two Americans and a South African before being shot dead, the government spokesman said.

The shooter also wounded two Americans and four Jordanians, one of them critically, said the spokesman, Mohammed Momani.

The motive was not immediately clear. Momani described the shooter as an "attacker" and said he committed a "crime," but did not say whether authorities considered the fatal shooting a terror attack.

The shooting, at a police training camp on the outskirts of the Jordanian capital, raises questions about Jordan's image as an island of relative stability in a turbulent region.

Over the past year, the pro-Western kingdom has taken on a high-profile role in the fight against extremists, including the Islamic State group, which controls large areas of neighboring Iraq and Syria. There has been concern that militants could carry out revenge attacks on Jordanian soil.

In a statement released by Jordan's state news agency, Petra, Momani said an investigation has been launched into "the reasons behind the crime."

In Washington, there was no immediate response from the Pentagon. The U.S. Embassy in Jordan said that it is in touch with Jordanian authorities, "who have offered their full support."