Two U.S. State Department contractors were killed after a Jordanian policeman opened fire Monday at a police training center, a U.S. official and a Jordanian government spokesman tell Fox News.

The shooter also killed two Jordanians and a South African, according to the Jordanian embassy in Washington. Police shot and killed the gunman, who was dressed in a military uniform.

Two additional U.S. trainers and at least two other Jordanians were reported hurt, and are receiving treatment in Amman.

DynCorp International, a Virginia-based company that provides security, aircraft and intelligence worldwide, confirmed some of its personnel were shot, but did not identify them. "The company extends its thoughts and prayers to all involved and to their families and loved ones," DynCorp said in a statement.

The shooting came 10 years to the day after a string of bombings killed a total of 60 people at three hotels in Amman. It's not clear whether Monday's attack was related, but it cast a troubling light on Jordan's image as an island of relative stability in a turbulent region.

More On This...

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.

U.S. 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.

The site of the attack, a U.S.-funded facility, is used for training Palestinian security forces. Hours after the shooting, dozens of armored vehicles were moving in and out of the large, walled training center on the outskirts of Amman.

Mohammed Momani, a spokesman for Jordan's government, denied the claim from a U.S. official that the death toll had risen to eight. The U.S. official spoke to the Associated Press on condition of anonymity because he was not authorized to speak publicly on the matter.

Speaking from the White House, President Obama said, "We take this very seriously and will be working closely with the Jordanians to determine exactly what happened."

A military official said the attacker was a police captain who worked as a trainer at the facility. The captain was married and had two children, said the official, who spoke on condition of anonymity because the government has not released the assailant's identity.

The U.S. embassy in Amman "strongly" condemned the attack in a statement, promising a "comprehensive investigation." Officials say the embassy has not changed its security posture.

State Department spokesman John Kirby told reporters, "We are in contact with the appropriate Jordanian authorities, who have offered their full support."

Al Qaeda in Iraq claimed responsibility for the Amman hotel bombings in 2005, which also injured 115 people.

Fox News' Jennifer Griffin, James Rosen, Lucas Tomlinson and The Associated Press contributed to this report.