Children under 18 years old could no longer be committed against their will to St. Elizabeths Hospital at their parents' request without a full hearing in which they are represented by attorneys, according to a general agreement reached here in an attempt to end a four-year-old lawsuit.

Although attorneys for the Children's Defense Fund, the U.S. government and the D.C. government are still working out the final details of the new procedure, they have agreed in principle to end the practice of involuntarily committing such children almost solely at the parents' request.

The attorneys all agreed that the D.C. law that provides for such commitments - and which keeps about 40 children at a time ranging from 5 to 17 years old in the mental institution for prolonged periods of time - is unconstitutional.

The agreement comes at a time when the issue of "children's rights" has been coming more frequently before courts across the country. In these cases, children are creating their own movement for equal protection and are suing their elders in an effort to be treated as adults.

Attorney Daniel Yohalem of the Children's Defense Fund in Washington said the problem of children being institutionalized without hearings is "pervasive," and that the general agreement that has been reached in the D.C. suit is a major step in the children's rights struggle.

"I think that this issue is of crucial importance to protect children against inappropriate placement in mental hospitals and to assure that families have the opportunity to carefully consider all other alternatives to institutional placement," Yohalem said in a telephone interview yesterday.

Attorneys said the problem that arose was that ill-informed parents would merely turn to St. Elizabeths to deal with a child when they were at their "wit's end," or merely to get the child out of an unhealthy family situation without considering possible alternatives to commitment.

The suit in which the agreement has been reached was filed on behalf of four St. Elizabeths patients under 18 years old who used pseudonyms throughout the litigation to avoid embarrassment.

One, identified as Paul Poe, had been in the institution for three years and wanted to leave, but had no alternatives available to him under the law. Another, for example, was a ward of the city who had been placed there for about two years.

The attorneys said in the complaint that even if the children objected to the commitment, they were put into a category of "voluntary" patients and did not even receive constitutional safeguards given "involuntarily committed patients."

Government attorneys originally supported the statute allowing commitment of juveniles, saying the children were mentally ill and their parents should not face the "necessity of a legal proceeding" before the "best interests of the child and society" could be considered.

"Since parents are held responsible for the conduct of their children, parents should be able to seek treatment for children who require it," federal attorneys said, pointing out that there was no evidence of widespread abuse of the practice by parents.

However, as the case progressed, the federal government took a different position in a similar case pending before the U.S. Supreme Court and decided that it could no longer defend the constitutionality of the D.C. statute, according to the court files.

The District government, which originally was not a defendant in the case, later entered it voluntarily and is participating in the final agreement.

A bill involving many of the details included in the proposed interim court agreement is pending before the D.C. City Council. U.S. District Judge Louis F. Oberdorfer said at one point that he hoped there would be a legislative rather than judicial solution to the case. However, no final action has been taken on that bill.

The District and federal government say that any order ending the case - which must ultimately be approved by Oberdorfer, U.S. District Chief Judge William B. Bryant and U.S. Circuit Judge Malcolm R. Wilkey - should remain in effect only until the new law is passed or there is a definitive Supreme Court ruling on the issue. The plaintiffs oppose that plan, however, and want the order to be merely "reassessed" if either action occurs.

The new procedures would not affect the ability of the District of the District to place in institutions any juveniles who can be shown to be dangerous to themselves or others, attorneys said. It would instead provide for safeguards to make sure that children who were being committed largely at the request of their parents could legally fight their commitment if they desired.

Attorneys said they hoped a final order in the case, in which their differences on procedural details would be ironed out, would be filed soon.