TORONTO – The five years a mentally ill man spent in maximum-security immigration custody before being deported to his native Jamaica did not amount to cruel and unusual punishment, Ontario’s top court ruled Thursday.In upholding an earlier decision, the Court of Appeal agreed Alvin Brown’s lengthy detention was neither arbitrary nor indefinite, and concluded he had no claim to damages in the case.“Despite delays and unanticipated problems that resulted in the lengthy detention, (the incarceration) had not become illegal because there was a reasonable prospect of the removal being effected throughout the process,” the Appeal Court found. “Although the (Canada Border Services Agency) encountered a number of problems and the delays were significant, these were largely caused by the Jamaican authorities.”Brown arrived in Canada in 1983 as an eight-year-old and became a permanent resident in 1984. The federal government revoked his residency status in 2005 and ordered him to leave following a string of convictions, some for violent offences. Canada Border Services Agency detained him in early 2011 after he had served his time pending his removal.He spent the next five years in a maximum security prison trying unsuccessfully to have the removal order quashed. During that time, immigration officials tried to ensure he had the necessary travel documents. Jamaican officials wrangled over whether he was in fact a citizen and then raised questions over his mental-health needs.Ultimately, the Jamaicans issued him travel papers and he was deported in September 2016 as his lawyers argued the father of six, who is in his 40s, deserved damages of $1,500 for each day he had spent in immigration detention.In December 2016, Superior Court Justice Alfred O’Marra ruled against Brown. Among other things, O’Marra found no rights violations and that Brown had received adequate medical care while in custody. The judge found the detention was warranted given Brown’s history, and blamed Jamaican authorities for much of the delay in deporting him.Brown appealed, alleging O’Marra made several errors. Among them, he argued the judge was wrong in failing to find the detention had become indefinite because it had long been clear the prospects of a quick deportation were slim. The Appeal Court disagreed on all counts.Contrary to Brown’s assertions, case law does not set a maximum length for detention, the Appeal Court said. Instead, the panel found, assessments of a detention must turn on the specific facts of each case in which the rights of a detainee against arbitrary or indefinite detention and the reasons for the incarceration must be weighed against the prospect of reasonably speedy removal.The Appeal Court also rejected arguments that international law and principles “somehow stand for” the idea that any such detention longer than 18 months is illegal.On the issue of whether Brown would have been entitled to damages if his detention had been deemed illegal, the Appeal Court said it simply did not have the information to make such a determination. The record was “simply inadequate,” the court said, because Brown had raised his constitutional argument in the context of an application to be released from custody — an application that became moot when he was finally sent to Jamaica.Any future Charter-violation applications in similar circumstances should be raised and dealt with in standalone proceedings, the justices said.A Federal Court judge ruled last July in a separate case Brown raised that Canada’s rules for detaining foreigners who can’t be deported quickly are constitutional.