While most countries have deinstitutionalized, they still make it much easier to force treatment on an out-patient basis. (This is true of drugs as well, which is part of the reason "harm reduction" often works better in Europe--a credible threat of involuntary hospitalization.) This was the original plan in the 1970s in the US, to transition to out-patient care, but it didn't pan out. The mental hospitals were closed, but rather than shift the funding to out patient clinics and treatment, the funding was simply pulled altogether. And because of the civil rights law over-correction, addressing this is more than simply re-establishing the funding. California, for example, restored hundreds of millions of funding in the past decade, but for various legal and inertial reasons, cities and counties simply won't force treatment plans on even the most desperately ill patients, even when they're harming themselves or others. Sadly, we're slipping back into using the penal system to house the mentally ill; there's less political and institutional pushback than increasing the use of conservatorship and civil commitment.
The problem has been well known for more than 40 years. Here's a 1984 piece from the NY Times that could be written the same today: Richard D. Lyons, "How Release of Mental Patients Began", https://www.nytimes.com/1984/10/30/science/how-release-of-me...
Where are you getting that? Which countries? Certainly in Ireland and the UK, I'm pretty certain that it is all but impossible to force outpatient treatment, and I think this is generally more or less the case in Western Europe as a whole. Involuntary admission to psychiatric hospitals is still, marginally, a thing, but very rare.
https://www.nhs.uk/mental-health/social-care-and-your-rights...
Easy to find stories people being threatened with these laws into accepting treatment:
https://www.mentalhealthforum.net/forum/threads/threatened-w...
If you're wondering why human rights treaty organizations are so involved with these laws, and with the similar laws concerning children, look up how the holocaust started. But ... you don't really want to know the connection there.
Ireland, for instance, had the highest rate of psychiatric institutionalisation in the western world in the 60s (some Warsaw Pact countries were likely higher). It was rapidly phased out in the 80s and early 90s. Homelessness remained rather low until the mid-tens, then rose rapidly. I've never heard of anyone attributing this to the mental hospitals closing 30 years previously (this seems to be a uniquely American belief); it is generally attributed largely to _shortages of housing_.