Relatives of those being held hostage spent anxious hours as the situation unfolded

Colombian security forces have freed around 20 shoppers and employees who had been held hostage for about 17 hours at a supermarket in the city of Cartagena.

Gunmen had stormed into the building at 08:00 local time (13:00 GMT) on Tuesday after what Colombian President Abelardo de la Espriella said was a failed attempt at robbing an armoured car carrying money.

They held those inside at gunpoint while trying to negotiate their getaway.

With the situation becoming ever more intense as the day progressed, de la Espriella gave the green light for special forces and police to launch a daring operation to free the hostages, killing one gunman.

Residents living near the supermarket reported hearing explosions as the security forces moved into the building.

Police later confirmed that officers had used stun grenades to overpower the hostage-takers. Four have been arrested.

Around 20 people were still being held hostage when the security forces moved in

De la Espriella described it as "an extraordinary joint operation", which he said had been carried out "flawlessly".

He flew into the northern city to oversee the operation personally. He could be seen flanked by the commanders of the operation with a handgun strapped to his belt, in footage released following its conclusion.

De la Espriella said the gunmen had been given the chance to hand themselves in but had refused.

Earlier in the day, the assailants had freed 10 of the hostages, among them elderly women.

But they continued to hold around 20, even as a police helicopter hovered above and special forces teams prepared to enter the building, located in a popular shopping centre.

Local media report that, as well as asking for safe passage out of the supermarket, the gunmen also demanded nearly $2m (£1.5m) and armoured vehicles.

De la Espriella said they had no political affiliations but had taken the hostages once their plan to rob a cash-laden armoured car had been foiled.

"It's not that a terrorist group carried out a kidnapping - no, these are criminals who were caught off guard, had no way out and then kidnapped a group of people," he said.

Johan Correa, one of the rescued hostages, described to local media how the gunmen, who he said had been disguised, had entered the supermarket, where he worked.

"We had just started our shift when some guys dressed as police officers came in and started robbing the place," he said. "They were robbers, but we thought they were police."

He added that he and other hostages had been locked in a cold storage room, face down with their hands tied.

"We were there for more than four hours, lying on the floor with our hands tied, and it was a really tough experience."

Another employee, Dayro Rafael Velázquez Castrillo, told Caracol radio that the assailants wore masks and had been armed with guns and knives.

Velázquez said the gunmen repeatedly threatened the hostages, telling them that they had rigged the exits with explosives.

Relatives and bystanders congregated outside the entrance to the supermarket

He said that "thank God" they had been rescued, describing moments of tension as they heard explosions and a helicopter flying above.

Photos taken during the rescue operation show armed soldiers inside the building as people kneel with their hands behind their heads.

It is unclear from the photos whether those kneeling are hostages or the hostage-takers.

Local media report that the authorities feared that some of the gunmen may have tried to pass themselves off as hostages as the rescue mission unfolded.

The identities of the four arrested have not yet been released.

The hostages are being reunited with their families after being checked over by medical teams, according to the mayor of Cartagena.

Many anxious relatives had spent hours waiting for news outside the perimeter place around the supermarket by security forces.

A woman called Sandra told Caracol that her 76-year-old mother was one of those being held hostage.

Sandra's mother - among a group of elderly people released after six hours - was reunited with her daughters and grandchildren.

Footage recorded by local media showed bystanders cheering as some of those freed were escorted to ambulances waiting nearby.

But with around 20 people still inside the building, tension outside rose and police said they had to stop some of the relatives from breaching the perimeter.

At one point, flights into the city were halted, with planes diverted to Barranquilla.

Special forces, including units specialised in dealing with kidnappings, were deployed to Cartagena, a popular destination among foreign and Colombian tourists.

Cartagena's Mayor Dumek Turbay called for calm but the granddaughter of one of the hostages told Colombian newspaper El Tiempo that "this shows we're not safe anywhere".

De la Espriella was elected earlier this year on a promise to crack down on Colombia's criminal groups.

He had travelled to the central city of Villavicencio to inspect the damage caused by a car bomb that detonated outside the regional government's offices on Tuesday.

While de la Espriella blamed the leader of a dissident rebel group for that attack, he was adamant that the hostage takers were "simple bandits" without political affiliations.

Car bomb tears through Colombian city wounding more than 20

Eight killed in Colombian air strike targeting Gulf Clan gang