TORONTO - The family of a Toronto university student who was detained in Bangladesh after surviving a terrorist attack says the young man has been transferred to prison.

Tahmid Hasib Khan's family has maintained the 22-year-old's innocence ever since the July 1 attack at a restaurant in Dhaka, the country's capital.

"We want the court to affirm what we know - which is that he is innocent," said Khan's older brother, Talha, who is a Canadian citizen. "We want to take him to a mental health professional as soon as possible because of the trauma that he's been through. But I don't think it's going to be any time soon."

Tahmid Hasib Khan is a permanent resident of Canada and an undergraduate student studying global health at the University of Toronto.

He had arrived in Dhaka on July 1 to celebrate Eid with his family, and planned to travel to Nepal to begin an internship with UNICEF the following week.

He was with friends at the Holey Artisan Bakery when five armed gunmen attacked, killing 20 people and holding others inside hostage. Security forces stormed the restaurant on July 2, killing the gunmen and rescuing the remaining hostages.

Since then, Khan's case has been fraught with confusion.

He was first taken into custody for questioning after the attack. His family was allowed brief initial contact with him but then lost touch with him for days until police formally announced his arrest at the beginning of August and sought court permission to question him.

That permission was granted and Khan's detention in police custody was then extended until he appeared in court last Saturday, his family said.

At that appearance, he was ordered into "judicial custody" and sent from a police station, where he had been held, to an area of a prison where those whose cases are still in progress are detained, his family said.

"In Bangladesh the judges have the right to hold somebody in custody as long as they think they will be valuable as a witness to the case," Khan's brother said. "We don't know actually how much longer it might take. It could take weeks, months, anything."

Also part of the narrative around Khan's case are media reports which quote hostages from the restaurant attack saying Khan was ordered to hold a gun during the attack, and that he was photographed doing so.

Khan's brother says the photographs, which were published by at least one local outlet, confirm hostage reports that the young man was forced to hold a gun.

"People who know him a little, people who know him a lot, everyone, his friends at UofT, his friends in Bangladesh, friends all over the world, they know, (he's) 100 per cent innocent," Khan's brother said. "We're just waiting for the court to officially say that."

The case has taken a toll on Khan's family, his brother said, but one positive development in recent weeks is that Khan's parents have been allowed to visit him on occasion after he was formally arrested.

At a recent visit in the prison where he's being held, Khan urged his family to try to stay calm, his brother said.

"Tahmid looked a little anxious, the family became very emotional after seeing him...he told everybody not to worry and to be patient," Khan's brother said. "So far he's been very strong."

Global Affairs Canada has said Canadian officials were monitoring Khan's situation.

Khan's brother, who sent a letter to Prime Minister Justin Trudeau's office last month seeking help, said his family is grateful for the support Ottawa has provided so far.