TORONTO -- Canada's immigration regime allows for indefinite and arbitrary detention and is therefore unconstitutional, Federal Court heard Monday.

What's needed is robust process and a legal limit on how long foreigners can be held when speedy deportation is unlikely to happen, court was told by lawyers for a Jamaican man who spent five years in custody

"This is a case of the Canadian state depriving human beings of their most fundamental rights," lawyer Jared Will said in his submissions. "Lengthy indefinite detention is contrary to the principles of fundamental justice."

At issue are provisions in Canada's immigration law that allow foreigners facing deportation to be detained -- frequently under maximum security conditions -- when the government considers them a flight risk, a danger to the public, or cannot confirm their identity.

The case being heard was launched by Alvin Brown, a mentally ill father of six who was deported to Jamaica last September. He had spent five years in detention as a danger to the public based on prior criminal convictions, mostly drug and weapons offences. Canada could not deport him until Jamaica issued a travel document.

While detention reviews must by law take place every 30 days, Brown's lawyers told Judge Simon Fothergill that the process is stacked against detainees, and the reviews all too frequently amount to a rubber stamp.

The result is that hundreds of people find themselves behind bars for months or years -- an unjustifiable violation of constitutional guarantees and Canada's international obligations, the lawyers said.

Will argued detentions should be capped at six months -- unless the government can prove compelling reasons to hold a person for longer. The European Union, for example, allows a maximum of 18 months, court heard.

"It's a hard cap," Will said. "It cannot be exceeded."

Brown's co-counsel, Jean-Marie Vecina, rhymed off a series of problems with the current legal regime that render the detention reviews largely meaningless.

For example, she said, an initial finding that someone poses a danger becomes prevailing wisdom that is all but impossible to refute.

The board member who decides whether to release someone frequently bases the decision on oral submissions from the government's representative that cannot be properly scrutinized and for which evidence is not always provided, Vecina said.

In addition, she said, the government is under no obligation to disclose information that might be favourable to a detainee, who may not even know exactly what the case against him or her is.

Fothergill frequently wondered whether the regime itself was unconstitutional or whether its implementation was flawed.

"The current law itself is unconstitutional," Vecina responded. "It is not a fair process."

The lawyers said the situation can amount to cruel and unusual punishment that can cause tremendous psychological damage.

Brown, who was sent back to Jamaica as a 40-year-old after more than three decades in Canada, called his experience "horrible."

"I would have rather been dead than detained, not knowing when I would be released," Brown said in a statement. "It was traumatizing."

The group End Immigration Detention Network, which has standing in the unprecedented case, rallied outside the court on Monday. The group wants a 90-day limit on detentions.

It said hundreds of foreigners are currently detained in Canada, many housed with hardened criminals.

At least 15 detainees have died in custody since 2000, more than half in provincial jails in Ontario, the group said, but Canada Border Services Agency provides almost no details.

On hand for the rally was Kimora Adetunji, 33, whose husband has been in immigration detention for the past eight months. Holding their two-year-old son, Adetunji said the case has been devastating for her family.

The government is slated to offer its defence of the detention laws on Tuesday.