By Serajul Quadir

DHAKA (Reuters) - A Bangladesh court allowed police on Saturday to continue holding two men in connection with an attack last month claimed by Islamic State that killed 20 hostages at an upscale cafe in the capital, Dhaka police said.

Police told the court they needed more time to interrogate Hasnat Karim, a dual British and Bangladeshi national, and Tahmid Hasib Khan, a student at Toronto University, in connection with the assault on July 1. The families of both men say they are innocent.

Their cases have been marked by confusion. When the two men were remanded in custody earlier this month, police official Masudur Rahman told reporters they had been arrested "from two different places".

But their families say Karim and Khan were dining, separately, with family and friends when gunmen stormed the Holey Artisan Bakery. Karim, a 47-year-old engineer, was said to be at the cafe to celebrate his daughter's 13th birthday.

Police confirmed on Saturday that Karim has been formally arrested, while Khan was being held as a suspect. Both appeared before the court, with Karim being remanded for a further eight days and Khan for six.

Rahman said Karim was arrested because police needed "further details" because of information that emerged during his interrogation.

He told Reuters that video footage during the cafe attack showed Karim appearing to act "calm and normal with the militants." He declined to give any further information.

Karim's wife, Sharmina Karim, told Reuters it was not at all clear to her what was happening.

"He is innocent. He went to the cafe along with me and our two daughters," she said after Karim made his court appearance. "How can it be that he would go there knowing there would be such a massacre? Is this not unusual, unbelievable thinking?"

There was no immediate comment from the Khan family.

Karim and Khan were among 32 people rescued by police and taken into custody for questioning after the attack. Police released the others soon after.

During the attack on the cafe, Islamist militants singled out non-Muslims and foreigners, killing Italians, Japanese, an American and an Indian before security forces stormed the eatery to end the 12-hour siege. Two police also died in the operation.

The government has dismissed suggestions that Islamic State has a presence in Bangladesh, even though photographs of attackers posing with assault rifles in front of the group's black banner were posted on the group's propaganda outlets.

Neither Karim nor Khan appeared in the photographs.

(Reporting by Serajul Quadir; Editing by Tom Lasseter and Tom Heneghan)