Colombian security forces rescued around 20 shoppers and employees held hostage for about 17 hours at a supermarket in Cartagena. One hostage-taker was killed and four were arrested during the operation.

Gunmen entered the supermarket at 08:00 (13:00 GMT) on Tuesday after, according to Colombian President Abelardo de la Espriella, a failed attempt to rob an armoured car carrying money. They held people at gunpoint while trying to negotiate a way out.

Earlier in the day, the assailants released 10 hostages, including elderly women. Around 20 people remained inside as a police helicopter hovered overhead and special forces prepared to enter the supermarket, which is in a popular shopping mall. Local media reported that the gunmen demanded safe passage, nearly $2m (£1.5m) and armoured vehicles.

As the situation intensified, De la Espriella authorised special forces and police to launch the rescue operation. Residents nearby reported hearing explosions, and police later confirmed officers used stun grenades to overpower the hostage-takers.

De la Espriella flew to the northern city to oversee the operation. He called it "an extraordinary joint operation" carried out "flawlessly". After the rescue, he said the gunmen had been offered the chance to surrender but refused.

The president said the hostage-takers had no political affiliations and had seized people after their plan to rob the armoured car was 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.

Photos from the rescue show armed soldiers inside the building as people kneel with their hands behind their heads. It is not clear whether those pictured are hostages or hostage-takers. Local media reported that authorities feared some gunmen might try to pass themselves off as hostages. The identities of the four arrested have not been released.

Cartagena's mayor said the hostages were being reunited with their families after medical teams checked them over. Relatives had waited for hours outside the security perimeter. Sandra told news site Caracol that her 76-year-old mother was among those held. Her mother, one of a group of elderly people released after six hours, was reunited with her daughters and grandchildren.

Local media footage showed bystanders cheering as some of those freed were escorted to nearby ambulances. With around 20 people still inside, tension outside rose, and police said they had to stop some relatives from breaching the perimeter.

At one point, flights into Cartagena were halted and planes diverted to Barranquilla. Special forces, including units specialising in kidnappings, were deployed to the city, a popular destination with foreign and Colombian tourists.

Cartagena Mayor Dumek Turbay called for calm. The granddaughter of one hostage told Colombian newspaper El Tiempo: "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. On Tuesday, he had travelled to the central city of Villavicencio to inspect damage caused by a car bomb that detonated outside the regional government's offices. He blamed the attack on the leader of a dissident rebel group, while insisting the hostage-takers were "simple bandits" without political affiliations.