William Barrett, wearing a cape and a Superman shirt, was swatting at the air with his hands and yelling at passers-by when he first met his District social worker on a sidewalk near the White House.

By that time, Barrett, 56, a Korean War veteran and former security guard with a history of mental illness, had been sleeping on the streets and in shelters for seven months. He remembers taking advice from two imaginary women and amusing himself by breaking bottles on the escalator at a subway station.

After several conversations with the social worker, he asked for help. In an interview last week, Barrett said he still feels that he should "apologize to the world for taking up space." But in two months, he has reached the point where he can talk clearly about his situation.

"I used to try to explain to people who I was because I thought they kept getting me mixed up with Superman and Jesus Christ," Barrett said. "It sounds stupid now, but I thought it was rational behavior. I went to one agency for help, and they would send me to another agency. By the time you're through walking around, you say, 'To heck with the agencies and go back to the heat grate.' "

The District's mental health system has failed hundreds of men and women with problems similar to Barrett's, according to social workers and homeless shelter providers who attempt to secure benefits, medical treatment and housing for the city's mentally ill homeless. Some advocates warn that the system's weaknesses will be further exposed as the city begins to carry out plans to reduce the population of St. Elizabeths Hospital, a public mental hospital.

Last week, a report issued by a court-appointed committee strongly criticized city mental health providers for adding to the homelessness problem by using shelters as housing for people released from St. Elizabeths and psychiatric clinics.

The report stressed that the lack of suitable housing for people with mental illnesses has, in effect, trapped some of them in shelters or in substandard group homes that are inadequately monitored by the government. According to recent estimates, there are between 2,000 and 3,000 mentally ill homeless in the District.

"We are the dumping ground," said Ann Baxter, executive director for the Calvary Shelter, which stopped accepting patients referred by the Emergency Psychiatric Response Division of the city's mental health commission. "It is a quick fix for the mentally ill to put them in shelters. If there is no good system in place, everyone is going to end up where they started from."

Even without referrals from the city emergency division, Baxter said, she has trouble finding suitable housing for those at Calvary Shelter. She cited three mentally ill women who went to the shelter without proper medication or Social Security benefits. They now have their medication and benefits, and they are ready to live in supervised housing. But, Baxter said, "There is no housing and they are stuck here."

Walt Tabory, a staff member of Health Care for the Homeless, a private group, argued that under the existing system, mentally ill people who live in homeless shelters or on the streets are expected to assume responsibility for getting help.

"For people who are mentally ill, that is not a realistic expectation," Tabory said. "Those who can't do it on their own are on the streets or in shelters without medication, which accounts for the abundance of people walking in traffic, talking to themselves on street corners or begging for money."

Tabory, whose unit helps the mentally ill obtain Social Security benefits, estimated that nearly all of the 250 people he and his colleagues have worked with during the past 18 months would be receiving monthly disability checks if he could document that they are receiving regular mental health services.

Instead, he said, 60 are receiving checks of about $370 a month. Some of the rest drift in and out of the system, failing to make or appear for regular appointments.

Robert L. Washington, head of the two-month-old D.C. Commission on Mental Health, acknowledged that the system has limitations. But he argued that social workers and shelter operators who believe that the mentally ill do not receive adequate attention through city community facilities frequently push the city to hospitalize them even though they are not a danger to themselves or others.

City facilities for treating and housing the mentally ill are limited, Washington said. The city's two public mental health clinics have 200 slots for clients who resist treatment and need to see caseworkers.

For those who are hospitalized, Washington said, officials may have no choice but to let them return to shelters when they are released from treatment because of a shortage of group homes and other housing for the mentally ill.

"It will take years to build an ideal situation," Washington said. "Shelter operators have had these problems for years. There is a theory of rising expectations. They saw some changes and they expect things to happen quickly. I can't work any faster."

Julie Turner, the social worker helping William Barrett, contends that the city has fallen short of providing crucial services that could change lives.

When Turner, who is with the homeless unit of the Downtown Cluster of Congregations, began working with Barrett in October, she concluded that he needed immediate psychiatric intervention because his behavior -- failing to seek medical attention, dressing like Superman and being disruptive in public -- posed a danger to himself and others.

Turner said that when she referred Barrett to the District's Emergency Psychiatric Response Division, he was given a one-week supply of medicine but was not admitted to a treatment program or hospitalized for observation.

"Releasing a mentally ill person back to the streets with a handful of pills was not a proper response," Turner said.

Robert Keisling, chief of the psychiatric response division, was on vacation Friday and could not be reached for comment. Washington said he could not discuss individual cases.

Turner said she helped Barrett get temporary housing in an overnight shelter with the assistance of a private doctor. But in a separate case, Turner said, she reached a dead end after helping a 67-year-old homeless man obtain Social Security and medical benefits.

The man, whose identity is being withheld at Turner's request, refused housing, saying he would stay on the streets rather than surrender four knives and a metal pipe that he said he carries for protection from street people and the FBI. After spending two weeks at St. Elizabeths this month, the man was placed in a cab by the hospital staff and told to go to a bus station, Turner said.

The man, who Turner said is legally blind and cannot distinguish between a $1 bill and a $20 bill, was carrying more than $300 in Social Security benefits and was supposed to purchase a bus ticket to Indiana so he could stay with his 83-year-old mother. He appeared at Turner's office the next day with $70 in his pocket. The man said in an interview that he never bought a ticket.

Dr. Catherine May, a St. Elizabeths psychiatric resident who handled the man's case, said she could not discuss it because of confidentiality rules.

May said St. Elizabeths doctors, in general, try not to discharge patients to shelters or the streets. But if a patient wants to return to a homeless situation, May said, doctors have no legal alternative unless they can prove that the patient is a danger to himself or others. In the past six weeks, May said, she has discharged one patient to a homeless shelter because he asked to be sent there.

"We feel an incredible strain between what is our social obligation to the patient and the limitations of legal requirements and of the available social services," May said.