This article is more than
8 year oldGunmen stormed the Holey Artisan Bakery cafe in Dhaka late on Friday before troops entered almost 12 hours later.
Six of the attackers were also killed and one was arrested, a government spokesman said. The attack was claimed by the so-called Islamic State (IS).
Italy's PM Matteo Renzi confirmed that Italians were among the dead.
Italian news agency Ansa said up to 10 Italians may be unaccounted for. The Italian press said many of those dining at the cafe worked in the garment industry.
Japan's Deputy Chief Cabinet Secretary Koichi Hagiuda said seven Japanese nationals were in the cafe but it was not clear if they were among the casualties.
The army had initially said all hostages killed were foreigners, but later reports said some Bangladeshis also died.
In other developments:
The siege began as diners were gathering to break their fast during the Muslim holy month of Ramadan.
"It was an extremely heinous act," Prime Minister Sheikh Hasina said in a televised statement. "What kind of Muslims are these people? They don't have any religion.
"My government is determined to root out terrorism and militancy from Bangladesh."
Bangladesh's Daily Star newspaper said the gunmen tortured anyone who was unable to recite the Koran. They provided meals overnight for only the Bangladeshi captives, it said.
Sumon Reza, a supervisor at the cafe in the Gulshan district of Dhaka, managed to flee to the roof when the attackers burst in.
"The whole building was shaking when they set off explosives," he told local media. He later jumped from the roof and escaped.
"From 08:00 it all started," said Rashila Rahim, who lives near the cafe. "Gunshots, tank sounds... It was like we were in the middle, and gunshots from all around."
The timing, the target and the message of the attack on the Holey Artisan Bakery in Dhaka was loud and clear.
The Islamist militants struck on the last weekend before the Muslim religious festival of Eid al-Fitr. Dozens of diners were at the cafe, which is popular among foreigners and middle-class Bangladeshis.
The Gulshan district is a high-security area and considered among the safest places in Dhaka. Several embassies and non-governmental organisations are based in the neighbourhood and hundreds of foreigners and wealthy Bangladeshis live there.
The government had stepped up security after an Italian aid worker was killed in the area by suspected militants in 2015. It's difficult to travel through Gulshan without passing through a security check post. But the latest attack has shown that even Gulshan is not safe.
Over the past three years, more than 40 people have been killed in Bangladesh by suspected Islamists. But the attacks mostly targeted individuals - secular bloggers, writers, activists, academics and members of religious minorities. The attack on the cafe was on a different scale. It seems to have been well planned and well co-ordinated.
The attack began when eight or nine armed men burst into the cafe at about 21:20 (15:20 GMT) on Friday and opened fire.
Media reports quoted witnesses as saying that they shouted "Allahu Akbar", meaning "God is great".
At least two police officers were killed in exchanges of fire late on Friday, and 30 police officers were injured.
A statement on IS's self-styled Amaq news agency said militants had attacked a restaurant "frequented by foreigners".
Lt Col Tuhin Mohammad Masud, commander of the Rapid Action Battalion, told Associated Press the gunmen did not respond when asked to negotiate. It is unclear if they made any demands.
The attack comes after a spate of murders of secular bloggers, gay activists, academics and members of religious minorities, blamed on Islamist militants.
Newer articles
<p>The two leaders have discussed the Ukraine conflict, with the German chancellor calling on Moscow to hold peace talks with Kiev</p>