A University of Toronto student was arrested without charges in Bangladesh for his alleged involvement in last month's restaurant attack, leaving his friends feeling frustrated and helpless.

Tahmid Hasib Khan, 22, a permanent resident of Canada, hasn't been heard from since the July 1 attack in the Bangladeshi capital of Dhaka.

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. Nine Italians, seven Japanese, three Bangladeshis and one Indian died.

Khan's friends and family say he's been in police custody since then, though police have denied it.

A Dhaka police spokesman said Khan was arrested in Dhaka on Thursday, and a court has allowed police to keep him in custody for eight days for questioning.

The Bangladesh English-language newspaper The Daily Star reported that Khan and a 47-year-old British national were arrested under a part of the Bangladeshi criminal code that allows police to arrest and detain a person with court approval, but without a warrant and without laying charges.

Khan, an undergraduate student studying global health at the University of Toronto, had travelled to Dhaka to visit family, with plans to go on to Nepal where he was to begin an internship at UNICEF last month.

Khan's friend Jane Rahman, speaking from the U.K., said that he had talked about becoming a veterinarian, and had a passion for music. She said that when she first met him at a wedding, he was singing a song with his cousin, a capella.

"When I say it out loud, it sounds really soppy, but he's one of those guys who always brings a smile to your face," she said. "He's really lively, friendly and also very kind."

Rahman said she's left feeling helpless and heartbroken at what her friend has had to go through. She said it's obvious to anyone who knows him that he had no involvement in the attack, noting that he was involved in the community and sometimes posted on Facebook about the importance of women's rights.

She said she's heard surviving hostages from the attack speak out in Khan's favour.

"We know that, in the morning, it was he who spoke to the attackers and persuaded them to let the hostages who remained alive to be released," she said. "There's such a body of witness evidence that seems to say he wasn't involved. It's just, sometimes that gets lost."

Khan's family asked Prime Minister Justin Trudeau on July 11 to intervene in the case of the young man, who is a permanent resident of Canada. The family said they don't know why Khan was being held, but insisted he had done nothing wrong.

After the attack, a group of Khan's friends launched a social media campaign that includes a Facebook page under the name "Free Tahmid" which has garnered more than 65,000 "likes."

Members of Khan's family couldn't be reached for comment after news of his arrest broke.

Bangladesh police have said they are investigating whether the attackers had links to the Islamic State 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.

British national Hasnat Karim was arrested at the same time as Khan.

Karim was in the restaurant with his wife and two daughters at the time of the attack and the family had said they were there to celebrate their daughter's birthday.

A South Korean man from a nearby apartment shot a video of the scene in the restaurant that allegedly showed Karim 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.

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.

-- With files from The Associated Press