U.S. President Barack Obama said he was treating the attack at the King Abdullah Training Centre - in which four Jordanians and one Lebanese citizen were wounded - very seriously and a full investigation was under way.
The gunman's background and motive were not immediately known. But Jordan is a staunch U.S. ally in the Washington-led campaign against Islamic State militants who hold large areas of neighbouring Syria and Iraq, a position Jordanian officials say leaves the kingdom vulnerable to extremist attacks.
Campus violence: At least 15 dead in Oregon college shooting
"This incident sadly does not come as a surprise as the threat of terrorism has only increased in the region in the last few years in the aftermath of Syria and Iraq. As much as pre-emptive measures have been taken, it is impossible to eradicate all risks," said a senior Jordanian official who requested anonymity, citing political sensitivities.
The gunman was a police captain and co-trainer at the King Abdullah Training Centre, a senior Jordanian official told Reuters.
The attacker's identity and details of his background were not immediately released. The U.S. Embassy in Amman said two American civilian security contractors and a South African contractor were shot to death, and the slain Jordanian was a translator according to the Jordanian government.
A U.S. official said the two Americans were working for the U.S. State Department's International Narcotics and Law Enforcement Affairs Bureau training Palestinian security forces.
"The investigation is ongoing and it is premature to speculate on motive at this point," a U.S. embassy statement said.
"We are working closely with the government of Jordan and local security services on a full and comprehensive investigation. We strongly condemn this incident and we deeply appreciate the cooperation and support received from our Jordanian partners."
Jordan slams Israeli aggression against Muslims in Al-Aqsa
The shooting spree took place on the 10th anniversary of al Qaeda suicide bombings that targeted three Amman luxury hotels and killed 57 people, the deadliest militant attack in Jordanian history.
Security sources said several earlier militant plots to attack the King Abdullah training centre had been foiled. Jordanian government spokesman Mohammad Momani said the attacker was gunned down by Jordanian security forces inside the training centre.
He did not commit suicide as security sources had earlier reported. The training facility was set up on the outskirts of the capital Amman after the 2003 U.S. invasion of Iraq to help rebuild the shattered country's post-war security forces and to train Palestinian Authority police officers.
Jordan hosts several hundred U.S. contractors who are part of a military programme to bolster the kingdom's defences, including the stationing of F16 fighter jets that use Jordanian airfields to hit Islamic State positions in neighbouring Syria.
But Jordan's role in the war against Islamic State has raised disquiet among some Jordanians about instability at their borders. They fear that Amman's enhanced role in the campaign might provoke Islamist bloodshed in their country.
Jordanian authorities have since tightened security around sensitive government districts, increased surveillance of radicals and jailed dozens on suspicion of plotting militant attacks on Israelis, Americans and other Westerners. King Abdullah believes fervently that ultra hardline extremists pose an existential threat to the kingdom.
Terror on the railway: Shooting on Amsterdam-Paris train injures two
Since the civil war erupted in Syria in 2011, hundreds of Jordanians have joined Sunni Muslim militant groups in the insurgency against President Bashar al-Assad. But Jordan's Western-aligned monarchy is torn by conflicting interests over Syria. It has tried to steer a middle course between that of Gulf Arab allies who want Assad ousted at almost any cost and its own concerns - echoed by Washington - that a radical extremist victory in Syria would install a worse threat.
That ambivalence means that while Jordan has hosted small-scale U.S. training of rebels and allowed modest quantities of Gulf-supplied arms to filter into Syria, it has ensured that its border has not become an easy conduit for guns and combatants.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ