Hours after terrorists killed 20 hostages in a café in the capital, Dhaka, Bangladesh’s Prime Minister Sheikh Hasina Wazed says the militants are "tarnishing" the image of Islam and must stop killing people in the name of the religion.

“Islam is a religion of peace. Stop killing in the name of the religion,” Hasina said in a televised address to the nation on Saturday, during which she also declared two days of mourning.

“Please stop tarnishing our noble religion... I implore you to come back to the rightful path and uphold the pride of Islam,” she further said.

Late on Friday, a group of armed men attacked an upscale café in the diplomatic area of the capital at around 9:20 p.m. local time (1320 GMT), setting off explosives and taking a number of people hostage, including foreigners.

Police said eight to nine gunmen armed with assault rifles, grenades, crude bombs and swords were holed up inside.

Several hours later, police forces managed to enter the place to free the hostages. Two officers lost their lives in the clashes.

Bangladeshi policemen stand at an intersection of a street leading to an upscale restaurant after a bloody siege ended in Dhaka, on July 2, 2016. (AFP photo)

On Saturday morning, police declared an end to the 12-hour siege and said the café was free of gunmen. Six attackers were killed and another arrested alive during the operation.

Most of the killed hostages were foreigners, including several Italian and Japanese nationals. Daesh, in a statement, has claimed responsibility for the attack.

“Anyone who believes in religion cannot do such act. They do not have any religion, their only religion is terrorism,” Hasina added, vowing to fight terrorist attacks in her country and urged people to come forward.

In mid-June, Bangladesh police armed villagers in the country’s western regions with bamboo sticks and whistles to avoid Daesh attacks on secular intellectuals and members of the minority faiths.