VANCOUVER -- Forcing federal inmates into solitary confinement for indefinite periods is unconstitutional because it puts them at significant risk of psychological harm and suicide, a British Columbia Supreme Court judge has ruled.

But Justice Peter Leask suspended his decision Wednesday for 12 months to give the government time to draft new legislation, which he said must include strict time limits on how long someone can be kept segregated.

The British Columbia Civil Liberties Association and the John Howard Society filed the legal challenge in 2015, calling so-called administrative segregation a cruel and inhumane punishment that can lead to severe psychological trauma.

The Crown argued the practice is a reasonable and necessary tool when prisoners pose a threat to others or are themselves at risk of being harmed.

Leask's written decision concludes protracted segregation undermines the safety and security of inmates that the provisions are meant to promote.

"I have no hesitation in concluding that rather than prepare inmates for their return to the general population, prolonged placements in segregation have the opposite effect of making them more dangerous both within the institutions' walls and in the community outside," Leask says.

The decision says the risk of harm is intensified in the case of inmates with mental illness, but that all prisoners are at risk and many are likely to suffer permanent harm as a result of their confinement.

"Some of the specific harms include anxiety, withdrawal, hypersensitivity, cognitive dysfunction, hallucinations, loss of control, irritability, aggression, rage, paranoia, hopelessness, a sense of impending emotional breakdown, self-mutilation, and suicidal ideation and behaviour," the decision says.

Public Safety Minister Ralph Goodale said the government is reviewing the judgment and has been acting on the issue since early in 2016.

"Our government is committed to addressing the needs of the most vulnerable in the federal correctional system," Goodale said in a statement.

He did not say whether an appeal is planned.

The federal government introduced a bill in June that would set an initial time limit for segregation of 21 days, with a reduction to 15 days once the legislation is law for 18 months.

Jay Aubrey, a lawyer with the B.C. Civil Liberties Association, described Leask's ruling as the most significant trial decision on prison law in Canadian history.

"A society has to be judged by its most vulnerable members and how they treat them," she said. "Canadians don't stand for torture. We stand for basic human rights."

Administrative segregation is different than disciplinary segregation, which is already restricted by limits on how long inmates can be kept isolated.

Leask's decision says independent oversight is required when it comes to reviewing administrative segregation because Correctional Services Canada has demonstrated it is unable to fairly review its own conduct.

Josh Paterson, who heads the civil liberties group, described the conditions of segregation as similar to "modern-day dungeons."

"There is evidence before this court of walls covered in feces and food and other bodily fluids, of people who have to sleep with their head mere inches away from uncleaned toilets, of prisoners being denied cleaning supplies or shoes when there are toilets overflowing in the adjoining cells," he said.

"These are terrible places to be found for 15 minutes, never mind 15 weeks, 15 months, several years."

Paterson dismissed the changes to administrative segregation proposed by the federal government in its legislation as "completely unsatisfactory."