British national Hasnat Karim and University of Toronto student Tahmid Hasib Khan were arrested in different areas of the capital, Dhaka, and a court has allowed police to keep them in custody for eight days to question them, said Masudur Rahman, a Dhaka police spokesman.
Five armed gunmen attacked the Holey Artisan Bakery restaurant on the night of July 1, killing 20 people and holding others inside hostage. Security forces stormed the restaurant on July 2, killing the gunmen and rescuing the remaining 13 hostages. Those killed were nine Italians, seven Japanese, three Bangladeshis and one Indian.
Karim, 47, and Khan, 22, were known to have been inside the restaurant, but Bangladeshi authorities and police denied having them in custody after the attack. Their families and New York-based Human Rights Watch had appealed for news about them and said the authorities were holding the men.
Karim was in the restaurant with his wife and two daughters and the family had said they were there to celebrate the birthday of their daughter.
But a South Korean man from a nearby apartment had shot a video of the scene in the restaurant in which Karim was seen talking to the attackers.
Police also said there were photographs showing Karim smoking on the rooftop of the building with two of the attackers standing behind him.
"We are taking them to a court and we have already sought 10 days police custody for further questioning," Rahman said soon after the arrests.
Hours after his arrest, Karim's family said he was innocent and should be released immediately.
"He had no links to any terrorist group or organization. He and his family were celebrating his daughter's 13th birthday when they became victims of a terrorist attack," Rodney Dixon, the family lawyer, said in a statement.
He said the family was "willing to cooperate fully with the authorities to prove his innocence."
"There is clearly no evidence to charge him and he should be let go without any further delay," the family said.
"He is not a suspect and has not been charged," the statement said.
Karim had lived in UK for nearly 20 years and returned to Bangladesh a few years ago when he began teaching in a private university in Dhaka. Later, he was under investigation for his alleged involvement with a banned Islamic group, Hizbut Tahrir.
He left the university in 2012 and became a businessman. One of the attackers has been identified as his former student.
Khan was studying global health at the University of Toronto and was a permanent resident of Canada. His father was a businessman in Bangladesh and Khan had arrived in Dhaka a day before the attack. His family has said he has not done anything wrong.
Bangladesh police have said they are investigating whether the attackers had links to the ISIS group, which claimed responsibility for the attack. The claim was rejected by Bangladesh's government, which said IS has no presence in the country and instead blamed a local radical group, Jumatul Mujahedeen Bangladesh.
Follow NDTV for latest election news and live coverage of assembly elections 2019 in Maharashtra and Haryana.
Subscribe to our YouTube channel, like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.