DHAKA: Gunmen stormed a crowded restaurant popular with foreigners in the Bangladeshi capital Dhaka on Friday night, taking dozens of people hostage and triggering a deadly firefight with police, witnesses and officials said.

The Islamic State group (Daesh) claimed responsibility for the attack on the Holey Artisan Bakery restaurant in Dhaka´s upmarket Gulshan diplomatic quarter in which two police officers were killed.

Police said the gunmen burst in shouting "Allahu Akbar" (God is the Greatest) as people were having dinner at around 9.20 pm (1520 GMT) and set off explosives.

Some diners managed to escape, but police said there were still a number of people being held inside the restaurant hours after the assault.

Some managed to speak to relatives by phone, reporting there were up to 40 people trapped inside, around half of them foreigners, the private Ekattur TV station said.

Another told relatives he feared they would be killed if police tried to storm the restaurant to end the siege.

"He is very nervous," the man´s nephew, who had spoken to him by phone, told AFP.

"He urged the police not to storm the restaurant, saying the gunmen will kill them."

The White House said US President Barack Obama had been briefed on the attack, a rare occurrence in an area of Dhaka considered relatively safe.

"We are trying to communicate with them (gunmen). We want to resolve it peacefully," the head of Bangladesh´s elite security force Benazir Ahmed told reporters.

The restaurant´s supervisor Sumon Reza who escaped by jumping from the roof told a local newspaper there were 20 foreigners being held hostage.

"I was in the roof. The whole building was shaking when they set off explosives," he said.

Popular with foreigners

The IS-linked Aamaq news agency said the group was behind the attack and that "more than 20 people of different nationalities (were) killed".

Heavily armed police and paramilitary guards cordoned off the area after the gunfight broke out.

"Two police officers including the head of Bani police station were killed. It appeared they were hit by bullets and splinters from a grenade," deputy commissioner of Dhaka police Sheikh Nazmul Alam told AFP.

"Up to 20 police officers were injured. Seven-eight people have come out of the restaurant. But there are some people inside."

The attack took place near the Nordic Club, where expatriates gather, and the Qatar embassy as Bangladesh observes the Muslim holy month of Ramadan.

The French Ambassador Sophie Aubert said the restaurant was "very popular" among diplomats and other foreigners in Dhaka.

"We´re very concerned that there are some hostages inside," she told AFP, adding she was trying to confirm whether there were foreigners inside.