A bill that aims to end solitary confinement has passed in the Senate with a number of amendments — changes a large group of lawyers and law societies say are necessary to ensure the bill stays on the right side of the law.

Senators passed Bill C-83 at third reading Wednesday, complete with a package of amendments including adding judicial oversight to decisions about isolating prisoners, more supports for inmates with mental illnesses and community-based options for rehabilitating Indigenous people and members of other vulnerable populations.

Now, it will be up to the Liberal government to decide whether to accept the proposed changes. More than 100 legal experts say the bill would be unconstitutional if passed without the amendments.

"It has already been decided in two separate decisions (in B.C. and Ontario courts) that segregation without a cap and without independent oversight violates the Charter," the lawyers wrote in a letter sent to senators this week.

"With respect, we submit that passing a bill while knowing full well that it is unconstitutional is not only a waste of taxpayers' money, but it also raises questions regarding Canada's commitment to the rule of law."

Last October, Public Safety Minister Ralph Goodale announced Bill C-83 would end the practice of segregating federal prisoners who pose risks to security or to themselves.

Inmates who do pose risks would instead be moved to new "structured intervention units," where they are supposed to get better programming and mental-health care, and more contact with other people.

In their letter, the lawyers say they believe these new units are solitary confinement under a different name — a concern that has been echoed by a number of human-rights organizations.

The lawyers and legal scholars who signed the letter are urging the government to pass the bill with the amendments made by the Senate committee that studied the issue.

"We believe that these amendments transform what was a meaningless bill into a document that has the potential to make some positive changes in the lives of prisoners and uphold Canada's international human rights obligations."

Sen. Kim Pate, who sponsored many of the changes and who has been a lifelong advocate for prisoners' rights, said she remains optimistic the Liberal government will accept the revisions.

But if the changes that would have judges examine isolation decisions are not accepted, she said it will remain unconstitutional.

"I think the amendments will be recognized for what they are — that they actually strengthen the legislation, they help the government pursue their very laudable stated objectives of the bill and my hope is that they will be accepted."

Goodale's spokesperson, Scott Bardsley, said the minister will announce the government's response to the Senate's amendments within days.

But he also said the minister vigorously disagrees that Bill C-83 just preserves solitary confinement under a different name, and stressed the new intervention units will be qualitatively different: inmates will be legally entitled to meaningful human contact every day, and programs and rehabilitation will be provided.

As for judicial oversight, Bardsley said having isolation decisions reviewed by judges on a routine basis "would be a considerable and unnecessary burden on the court system."

"C-83 not only creates a new way of managing inmates who need to be separated for safety reasons, it also creates meaningful external review of those placements," Bardsley said.

Independent external decision-makers will be added to review cases if inmates don't get their minimum hours out of their cells or minimum hours of meaningful human contact within a prescribed time period.