The federal government is in the final phase of consultations to "transform" Canada's immigration detention policies, just as a landmark legal challenge tries to end the contentious practice of indefinitely jailing detainees.
Lawyers for Alvin Brown, who spent five years in maximum-security provincial jails before being deported to Jamaica last fall, are currently arguing before the Federal Court that the man's constitutional rights were violated.
Brown, 40, came to Canada as a child more than three decades ago. But the government stripped him of his permanent residency after a series of convictions, most of them drug and weapons related.
He was released from criminal custody in early 2011 and then detained months later for violating release conditions. But he languished in immigration custody after Jamaica failed to issue him travel documents.
He's one of thousands of people locked up each year by the Canada Border Services Agency — some for a day or two, others for months, and still others for several years.
Brown's case is raising fresh questions about why some people are held for so long, under what conditions, and what the government is doing to limit indefinite incarceration when it comes to immigration cases.
Why are people jailed if they haven't committed a crime?
Any person can be detained for up to 48 hours if they're considered a flight risk, a danger to the public, or if their identity can't be confirmed.
Another ground for detention is inadmissibility to Canada, whether for security reasons, for a violation of human or international rights, or for serious criminality or organized criminality.
Within 48 hours, a person is entitled to a detention review hearing at the Immigration and Refugee Board (IRB), an independent administrative tribunal that makes legally binding decisions.
Alternatives include conditions such as a curfew or residing at a specific address, paying a cash bond, or having a guarantor.
According to CBSA data, 6,596 people were detained between 2015 and 2016. That's down from 9,043 five years earlier.
At any given time, there is an average of 450 to 500 people in detention across the country under the Immigration and Refugee Protection Act. The average length of stay is 23 days.
Where are people incarcerated?
CBSA has three "holding centres" in Toronto, Vancouver and Laval, Que., but also uses provincial jails for higher-risk detainees, lower-risk detainees who aren't close to a holding centre, and people who are detained more than 48 hours in the Vancouver area.
"The CBSA works closely with its provincial correctional partners to minimize interaction, to the fullest extent possible, between immigration and criminal detainees," the CBSA website says.
But Gloria Nafziger, refugee and migrants co-ordinator for Amnesty International Canada, said many detainees are held in maximum-security facilities and "co-mingled" with convicted criminals. And those who are separated in other units have limited access to programs and visitors.
"These are not people detained for criminal reasons — it's an administrative detention," she said. "Yet they are isolated with a lack of programming, a lack of interaction, no befriending program or special arrangements in any way that recognizes their unique needs as people who are nothing more than people who have violated their immigration status in Canada."
Can children be jailed?
In 2015-16, 201 minors were detained or housed with parents or guardians. But CBSA says the number has been decreasing.
A report earlier this year revealed that dozens of children who are actually Canadian citizens have been held in immigration detention centres in conditions that can cause physical and psychological harm.
It found the best interests of the children were not adequately accounted for at the time of their parents' arrest and detention, and as a result, the fundamental rights of the children were violated.
CBSA says it carefully considers the best interests of children on a case-by-case basis, assessing options for alternative child-care arrangements, length of detention and what accommodation and services are available.
Holding centres have separate living areas for families and children have access to a teacher.
How are people treated behind bars?
There have been calls for greater transparency and accountability around this issue.
In December 2016, 150 people rallied in Toronto to protest the conditions of migrants being held behind bars. At the time, there were reports that 15 people had died while in custody since 2000.
And last July, about 50 immigration detainees at two Ontario prisons launched a hunger strike, pushing to limit the length of detentions to 90 days and to end the practice of putting detainees in maximum-security jails.
One of the detainees who took part, Richard Abuwa, told CBC News at the time that he was treated like an animal and had spent 27 months in indefinite detention.
Other detainees have reported feeling "traumatized" by prolonged detention.
What is the government doing?
Last summer, the Liberal government announced it was spending $138 million to build a "better, fairer immigration detention system" that promotes the humane treatment of people, while also upholding public safety.
Public Safety Minister Ralph Goodale said the goal was to make detention a "last resort."
"The government is anxious to address the weaknesses that exist and to do better," he said at the time.
The investment was aimed at expanding alternatives to detention, improving conditions at holding centres, reducing use of provincial jails, improving access to legal and spiritual advisers, providing better mental health and medical services, and strengthening partnerships with the Red Cross and UN.
Scott Bardsley, a spokesperson for Goodale, says consultations are still underway and will close on May 22.
As a "first step," the CBSA has increased mental-health training for staff at all immigration holding centres, and enhanced access to medical services, including psychological counselling and nursing care, to detainees held in Toronto.
But Nafziger said CBSA must end indefinite detention and find community alternatives to a penal institution.
She said community shelters, reporting requirements and supervision arrangements could avoid the despair of indefinite detention.
"You save the mental and physical health of a person by treating them like a human being."