A Jordanian police officer opened fire Monday at a regional police training center in the Jordanian capital, killing two Americans, a South African and a Jordanian before being shot dead, the Jordanian government spokesman said.
Two Americans, four Jordanians and a Lebanese were wounded in the shooting, said the spokesman, Mohammed Momani,
He said authorities are investigating whether the motive for the shooting was personal or political.
The government did not release the identity of the attacker, but a former member of parliament said authorities told him the shooter was 29-year-old Anwar Abu Zaid. The ex-parliamentarian, Suleiman Saed, is a relative of Abu Zaid.
Abu Zaid's brother, Fadi, told The Associated Press that Anwar was mentally stable and "not an extremist at all."
He said his brother, a father of two, joined the security forces at age 18, had been working at the training center for several months and had left for work as normal on Monday morning. Fadi Abu Zaid said the family demands to know about the circumstances of Anwar's death and will not accept his body until the authorities release more information.
In Washington, President Barack Obama said the attacker had been dressed in a military uniform.
"We take this very seriously and will be working closely with the Jordanians to determine exactly what happened," Obama said during an Oval Office meeting with Israeli Prime Minister Benjamin Netanyahu.
US forces in Afghanistan have come under attack on a number of occasions by local police and troops serving alongside them, in what are known as "green-on-blue" assaults. Such attacks have been extremely rare in the Middle East.
A US official said the Americans who were killed and wounded in the attack were part of a State Department police training program. The official said all were civilians, but declined to identify them. The official wasn't authorized to speak publicly on the matter and demanded anonymity.
Momani said the Jordanian killed in the attack was a civilian employee at the center.
He said the wounded are being treated at Jordan's main military hospital and were visited by King Abdullah II.
About two hours after the shooting, dozens of armored vehicles were moving in and out of the large, walled training center on the outskirts of Amman. The center was established in 2003, and has trained 53,000 police officers from Iraq, 8,000 from the Palestinian territories and additional groups from other Arab countries, according to its website.
Jordan, a close US ally that has a peace treaty with Israel, has long been seen 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.
"We have full confidence in our security measures, and the investigation will uncover the motivation behind what happened," Momani told The Associated Press. In an earlier statement, he referred to the shooting as a crime.