Islamist militants have killed 20 people, including at least nine Italians and seven Japanese, inside an upmarket restaurant in Bangladesh's capital, before security forces stormed the building and ended a 12-hour standoff.
Islamic State said it was responsible for one of the most brazen attacks in the South Asian nation's history, but that claim has yet to be confirmed.
It marks a major escalation in a campaign by militants over the past 18 months that had targeted mostly individuals advocating a secular or liberal lifestyle in majority-Muslim Bangladesh with 160 million people.
The gunmen, who stormed the busy restaurant in Dhaka's diplomatic area late on Friday night, ordered all Bangladeshis to stand up before they began killing foreigners, a source briefed on the police investigation said.
Among the dead was the wife of an Italian businessman killed by a machete.
She was found by her husband after he spent all night hiding behind a tree outside the cafe while the gunmen were inside, said Agnese Barolo, a friend who lives in Dhaka and spoke to him.
Nine Italians were killed in the attack, the country's foreign minister said on Saturday, and authorities were trying to confirm the fate of another person missing.
Japan's Chief Cabinet Secretary Yoshihide Suga said seven of its citizens had been confirmed dead in the attack, while one Indian, a 19 year-old female student, was killed in the assault, India's foreign minister said on Twitter.
Emory University in Atlanta said in a statement that two of its students were among hostages who were killed. Abinta Kabir, from Miami, was an undergraduate at Emory's Oxford College, and Faraaz Hossain, who was from Dhaka, was a graduate student at the university's Goizueta Business School, Emory said.
Bangladesh authorities are yet to say where all the people killed by the militants came from.
The killing of foreigners will likely shatter the confidence of the expatriate community in Bangladesh, many of whom work for multinationals in the country's US$26 billion (NZ$36.5 billion) garment industry that accounts for around 15 percent of the economy. Bangladesh is the world's second largest apparel exporter after China.
Thirteen hostages were rescued, including one Japanese and two Sri Lankans, the army said.
Army spokesman Colonel Rashidul Hasan said he could not yet confirm the nationalities of those who had died. Most of them had been killed by "sharp weapons", he said.
Hasan said initially that it seemed all the victims were foreigners but now the army believed some locals were among the dead as well.
Six gunmen were killed during the police operation and one was captured, Prime Minister Sheikh Hasina said in a TV broadcast after more than 100 commandos concluded their operation to clear the cafe. Two police were killed in the initial assault.
"It was an extremely heinous act. What kind of Muslims are these people? They don't have any religion," Hasina said.
Declaring two days of national mourning, she said the country would stand up and fight the "terror threat" that has mushroomed in its backyard.
Islamic State, which has claimed a series of machete attacks on minority groups in Bangladesh over the past year, posted photos of bodies and blood smeared across floors that it said were dead foreigners killed in the assault.
Police did not confirm whether the pictures were from the site of the massacre.