The criminal justice system faces an enormous challenge in confronting the needs of mentally ill defendants who regularly appear in courtrooms across the country. In the city of Toronto, a specialized Mental Disorder Court was created to deal with people with mental health problems who are charged with criminal offences.

A series running in the Toronto Star recently highlighted the staggering statistic that nearly twenty per cent of the Canadian population lives with a mental health problem or illness. In three per cent of the cases, the mental illness is severe.

A recurring issue in Mental Disorder Court is the unavailability of hospital beds for defendants requiring timely treatment as a result of judges making treatment orders. A number of judges, all highly experienced in dealing with the plight of the mentally ill accused who regularly appeared in their court, resolved to issue ''no stopover in jail'' orders. These orders required mental health hospitals to provide beds and accommodation for defendants on treatment orders regardless of the facilities available.

The practice of circumventing jail when treatment orders are issued was recently canvassed by the Ontario Court of Appeal. The appeal related to a treatment order issued by a judge in the Mental Disorder Court, Justice Mary Hogan, for a defendant charged with sexual assault who was found unfit to stand trial. Justice Hogan's order required the defendant to submit involuntarily to anti-psychotic drug therapy and to be conveyed directly to a named hospital to receive treatment for a period of up to sixty days. The purpose of the order was to make the defendant fit to stand trial.

Justice Hogan's order stipulated that the defendant couldn't be taken to jail during the treatment period. She made her reasons abundantly clear in an exchange with the Crown noting that ''it is about time the Province provided sufficient beds to deal with our mental health needs and it is not going to happen if I - you know, if we are prepared to do something as serious as make treatment orders and then say, but it is okay they can sit in a jail bed.''

The Ontario Court of Appeal wasn't swayed by Justice Hogan's message to the government to allocate public funds to service the needs of the mentally ill. The Court of Appeal was also unprepared to find that the consent requirement for a treatment order from the hospital violated the principle of fundamental justice in the Charter. There was explicit recognition by the Court that a person who has a mental illness cannot expect immediate treatment or to insist on a system of perfection that is unrealistic in a normal society.

The Court of Appeal was unsympathetic to a claim that the hearing judge's function is to ensure that the unfit defendant obtains the medical treatment needed in general. The Court held that ''the focus must be instead on whether the unfit accused receives the medical treatment necessary to make him or her fit as soon as practicable.''

The Ontario Court of Appeal's decision is disappointing. It condones a status quo that deems it acceptable for people with mental illness to be delayed immediate treatment. It is undisputed that Ontario jails aren't ideally suited to deal with the unique needs of mentally ill inmates and that incarceration generally poses increased risks of harm to the inmates' mental and physical health.

Mentally ill inmates suffering from serious psychotic illnesses will be commonly segregated in isolated areas of jails while they are deprived of urgent treatment that is medically necessary. In some instances they may be transported to psychiatric hospitals only to find that beds are unavailable. They may suffer from psychotic episodes in jail that seriously jeopardize their health.

It seems inconceivable that such an outcome can be consistent with a country that places a premium on Charter values and individual rights and freedoms. The goal isn't about insisting on a system of perfection. It is rather about demanding a caring and humane system of justice for the most vulnerable members of our society.

Listen to Steven's new radio show, Closing Argument, every Sunday afternoon at 4:00ET on NewsTalk 1010. You can also follow him on Twitter at @LegalAnalyst