State mental hospitals in the 1950s were, by most accounts, teeming warehouses set in remote rural areas far from the communities their patients once called home.

Some housed up to 8,000 patients and as few as 10 doctors, many of them foreign-trained physicians who barely spoke English. Shock treatments and lobotomies were popular, and therapy often consisted of working for free in the hospital laundry or the superintendent's mansion. Many poorly paid attendants made the rounds on the "bughouse circuit": They worked for a few weeks at one hospital, were fired after getting drunk on duty or abusing patients, and then moved to another.

In 1955 these conditions prompted Congress to appoint the Joint Commission on Mental Illness and Health, composed of the nation's leading doctors and educators. Under the direction of Dr. Jack R. Ewalt, then chairman of psychiatry at Harvard Medical School, the commission spent six years drawing up a 300-page report that became the blueprint for deinstitutionalization.

Several factors made the shift to community care possible. Mental health experts began recognizing that lengthy confinement was permanently damaging, resulting in a dependence so total that it left patients virtually unable to function in the outside world. Newspaper exposes and movies like "Snake Pit," the story of a nightmarish back ward policed by sadistic attendants, created a backlash against state hospitals. Lawmakers, concerned by the enormous cost and spiraling admissions, were eager to find a cheaper solution.

Emptying the hospitals would have been impossible without Thorazine, the powerful "wonder drug" that suppressed the most bizarre symptoms of serious mental illness. Discovered in France and introduced in American mental hospitals in 1955, Thorazine was the first in the family of drugs known as "major tranquilizers" that are widely used today.

Infused with the optimism characteristic of the postwar era, some of the nation's most eminent doctors told Congress they thought Thorazine might be the psychiatric equivalent of penicillin. The Kennedy administration, influenced by the commission's work, persuaded Congress to pass legislation in 1963 that established a nationwide network of 700 community mental health clinics.

"There was some overselling of drugs as a panacea," said Dr. Robert H. Felix, the former director of the National Institute of Mental Health and an architect of the policy of community care. "We didn't think it through far enough, and we didn't have any experience to think it through further . . . . But it was never our intention that states would just discharge gobs of patients."

That was precisely what many states did. Until the late 1960s, discharges occurred gradually. Then came a spate of successful lawsuits challenging informal involuntary commitment procedures and the quality of care in state hospitals.

Federal courts ruled that because commitment was analogous to imprisonment for people whose only "crime" was mental illness, treatment must occur in the "least restrictive" environment. State hospitals were ordered to improve care or discharge patients. Many opted for the latter.

The expansion of Social Security disability to the chronically mentally ill in the early 1970s enabled revenue-pinched states to shift a major financial burden to the federal government. As a result of this unlikely alliance between civil libertarians and fiscal conservatives, among them Ronald Reagan, then governor of California, hundreds of thousands of patients were "transinstitutionalized" into jails, shelters, nursing homes and boarding houses.

Local communities provided few services. Clinics, understaffed and underfunded, provided therapy for the so-called "worried well" -- the intelligent, insightful, middle-class neurotics. They largely ignored the chronically mentally ill, who were mostly schizophrenic, poor, dirty, inarticulate and emotionally draining and whose illnesses were far more complicated and intractable.

In big cities, especially New York, discharged mental patients relied on a large stock of cheap housing. Many of the single-room-occupancy hotels that catered to them have been renovated and turned into expensive apartments, the neighborhoods where they were located are suddenly fashionable, and their former residents are homeless. Gentrification, accelerated discharges from hospitals and the 500,000 people who have been dropped from the Social Security rolls during the Reagan administration have made the problems of the homeless, especially those who are mentally ill, far more visible.

So has the baby boom.

Because most chronic mental illness first occurs in late adolescence or early adulthood, the number of people with serious mental illness has increased since the 1950s. The population explosion has spawned a generation of patients called "the young adult chronics" whose illnesses are compounded -- and complicated -- by their use of drugs and alcohol. A generation ago, many would have spent years in hospitals.

"These are not burned-out schizophrenics who spent 20 years on some back ward," said Leslie Scallet, a Washington lawyer and mental health policy consultant. "They're uncooperative, they take up huge amounts of staff time . . . and they're highly mobile so they hop on a bus or walk and start all over again in a new place."

In the late 1960s, when other states were emptying hospitals and setting up community programs, Maryland did virtually nothing, the result of bureaucratic inertia, legislative disinterest and the power of institutional psychiatrists. Deinstitutionalization did not begin in earnest until 1978 after the election of Attorney General Stephen H. Sachs and Gov. Harry Hughes and the appointment of Dr. Stanley R. Platman as assistant secretary for mental health.

"We've really done things in a very poverty-stricken way in Maryland," said Platman, a nationally respected administrator who resigned last year. "We never got much money, and not everyone was committed to reducing the size of the institutions. Many saw them as their power base."

Maryland has done better than Virginia and the District of Columbia in developing community programs, according to Neal S. Brown, director of community support programs for NIMH. "Virginia has some isolated good programs, but in general the state has a long way to go," he said. "The District is unique. There have been many more resources going into St. Elizabeths, but the split between the District system and St. E's operated by the federal government has made it almost impossible to develop programs."

Ewalt, a former president of the American Psychiatric Association and, at 75, one of the few surviving members of the joint commission, has mixed feelings about the policy he helped shape.

"We made plans expecting results and we got consequences," he said. "Overall, I still think it has been a good thing . . . . If you see one of these bums wandering around on the street muttering to himself and going where he wants, well, I don't know if he's any worse off than being on a back ward muttering to himself and going where someone else wants him to go.