In the 20th century, the deinstitutionalization of mental health care took patients out of long-term psychiatric facilities with the aim that they might return to the community and lead more fulfilling lives. But in our rush to shut down America’s asylums, we failed to set up adequate outpatient services for the mentally ill, who now often fend for themselves on the streets or behind bars.

According to recent surveys, the number of state psychiatric beds has fallen from over 550,000 in 1955 to fewer than 38,000 in 2016. Meanwhile, research conducted by the Treatment Advocacy Center estimates over 355,000 inmates in America’s prisons and jails suffered from severe mental illness in 2012. Last year, a report by the Department of Housing and Urban Development found that over 100,000 Americans who experienced homelessness also suffered from severe mental illness.

Mental health advocates point to a number of failures, such as limited funding for outpatient care and a lack of political foresight, that may have led to this situation. Yet emerging community-based approaches to mental health care are providing hope for the severely mentally ill—as well as some constraints.

Court-ordered care for patients with severe mental illness, known as assisted outpatient treatment or AOT, is spreading nationwide. In December, President Obama signed into law the landmark 21st Century Cures Act, bipartisan legislation that bolsters funding for medical research and reshapes approval processes for drugs and medical devices. The law also supports a number of mental health reforms, including millions in federal incentives for states to develop AOT.

AOT varies by state, but here’s an example: Say a man with schizophrenia cycles in and out of hospitals, suffering from debilitating hallucinations. He stabilizes on his medications when hospitalized and then refuses to follow up with any care after discharge. A treatment team might request a hearing, in which a judge determines whether the patient warrants AOT.

A court-ordered treatment plan might include a care coordination team who meets with the patient, encourages him to attend follow-up care, and tracks whether he goes to appointments or takes medications. If the patient fails to do so, the law may empower authorities to pick him up and bring him to a medical evaluation.

Studies in multiple states, including North Carolina, Florida, and Iowa, have shown promising results from AOT. In New York, a pioneering state in this regard, research on over 3,000 patients found that hospitalizations fell by 77 percent and homelessness decreased by 74 percent among those who received these services. A study published in 2010 found the odds of arrest in New York were almost two-thirds lower for AOT recipients compared to non-AOT patients.

As many as 46 states have now enacted measures for AOT, and these policies have garnered support from organizations including the American Psychiatric Association and the International Association of Chiefs of Police.

Still, these laws are often underutilized. Some of this is due to lacked of trained personnel and underfunding, but fierce opposition to AOT plays a part.

Critics argue that AOT infringes on patients’ rights and harkens back to the days of asylums. Gina Nikkel, who leads the non-profit Foundation for Excellence in Mental Health Care, has called AOT a “civil rights issue." In Congress, many Democrats have opposed AOT on similar grounds, calling into question its effectiveness. During the drafting of the mental health provisions later incorporated into the 21st Century Cures Act, Senator Chris Murphy (D-CT) referred to the AOT proposals as “draconian” and fought a requirement that states implement the practice.

The legislation eventually passed with a compromise in its AOT provisions, one that incentivizes rather than mandates the use of these programs nationwide.

Another rising trend in community-based treatment is the use of long-acting injectable antipsychotics (LAIs). These medications provide patients with therapeutic blood levels of antipsychotics for weeks to months, requiring infrequent clinic visits for new injections.

Adherence to medications is a huge issue in mental health care, particularly among patients with severe mental illness. LAIs have emerged as a means of treating mental health patients for longer durations, with the hope that this might help patients lead more stable lives in the outpatient setting. The first LAI came about in the 1960s, but use of these medications has grown considerably in recent years. In 2009, the Food and Drug Administration approved Invega Sustenna, an injectable antipsychotic that lasts approximately four weeks, for patients with schizophrenia. In 2015, the FDA approved Invega Trinza (lasts three months)  and Aristada (four to six weeks) for similar indications. There are at least six LAIs used in the United States, and these medications now generate billions of dollars in annual sales.

Available evidence suggests LAIs are as effective as oral antipsychotics and may work even better for some subsets of patients. In 2013, a review of studies found that LAIs were significantly better than oral antipsychotics at preventing hospitalizations among patients with schizophrenia. Other recent studies have found LAIs may reduce health costs and resource utilization and may improve medication adherence and quality of life for patients.

Despite these findings, LAIs are also underused. Part of this may stem from patients’ fears of injections. Many prescribers feel uncomfortable using these medications, whether as a result of limited training or the perception that resorting to an injectable indicates failed treatment. In addition, as with AOT, concerns over patient autonomy come into play.

Though psychotic patients may be able to give informed consent for these long-acting medications, how often does this happen in actual practice? What happens if a patient wishes to stop taking the medication, but still has months of the drug left in his or her bloodstream? Should courts be able to mandate these medications on patients?

Given psychiatry’s sordid history with asylums, we should always be wary of forcing treatments on patients. Yet if the goal of deinstitutionalization was to treat patients with severe mental illness in the community, our failure to fulfill that promise begs for novel approaches to care.

There are less paternalistic ways to care for patients with chronic mental illness. For example, day treatment programs can help patients with more challenging mental health needs remain well outside the hospital. Incentivizing medical professionals to pursue training in mental health care could alleviate provider shortages and ensure better access to treatment. The 21st Century Cures Act promotes several key policies, from crisis de-escalation training for law enforcement to mental health parity in insurance coverage, that can help patients remain healthy in the community.

As Dr. Renee Binder, the former president of the American Psychiatric Association, wrote last year, “voluntary treatment without coercion and with adequate access and resources will always be the preferable method of care for our patients.”

But as she suggests in the same column, these approaches may not work for everyone. Some patients are best served by treatment options that blend oversight and freedom, that provide the structure of the asylum with a full life in the community. Just as we shouldn’t let patients with dementia wander the streets, we shouldn’t turn our backs on those with severe mental illness under the false impression of supporting autonomy.

The French philosopher Jean-Paul Sartre once wrote, “Man is condemned to be free.” Do we condemn our sickest patients when we prioritize their freedom over their health?