A number of tourists were taken hostage on Sunday by militants hiding out in a castle in Jordan following a shootout with police, security sources told Reuters.

A total of 10 people were killed in the shootings in the southern town of Karak, including at least four police officers, two civilians and a Canadian tourist.

The hostages were eventually freed - there are no reports of injuries.

Sky News Arabia quoted witnesses as saying that locals from the southern town of Karak, where the shootout took place, had intervened to free some of the hostages.

Earlier in the day a shoot-out between police and militants killed at least 10 people, including four Jordanian police, two civilians and one Canadian tourist.

Dramatic footage shared by the Egyptian news site Reyhan appeared to show part of the shootout, with armed police running around the famed historic site in a desperate attempt to locate the gunmen.

Separate footage claimed to show the chaotic aftermath of the shootout, with bloodstained clothing on the city's streets and armoured police cars rushing to the scene of the shootings.

The first attack took place when a police patrol went to check on a fire that broke out in a house in Karak, the department said.

"As soon as they reached the area, unknown gunmen who were inside the house opened fire on the patrol, wounding a policeman, and then fled by car," it said in a statement carried by the official Petra news agency.

At the same time, gunmen holed up in the Crusader castle opened fire on the Karak police station, "wounding several policemen and passersby" who were rushed to hospital, the statement added.

"Police and security forces have surrounded the castle and its vicinity and launched an operation to hunt down the gunmen," the statement said, adding that the search was still under way.

'Five or six' gunmen

The ministry said "five or six gunmen" were thought to be involved in the shootings.

The four Jordanian police officers were killed during the militants' shooting spree in the city of Karak.

The Canadian woman was killed after the militants hid in the castle and engaged in a shootout with police.

It is not known how or where the Jordanian civilians were killed.

The mosques of Karak used their minarets to urge residents of the town to stay away from the site of the shooting.

The gunmen continued to fire at police from the castle, a popular tourist spot, as special forces rushed to the scene from surrounding areas, a security source said.

The identity of the assailants was not immediately clear.

Karak Castle is a major tourist destination in Jordan - it is one of the three biggest Crusader-era castles in the region, the other two being in Syria.

Jordan is one of the few Arab states that have taken part in a US-led air campaign against Islamic State militants holding territory in Syria. But many Jordanians oppose their country's involvement, saying it has killed fellow Muslims and raised the security threat inside Jordan.