*259OPINION OF THE COURT
Edward H. Lehner, J.After trial the court finds that the success of in-patient care and treatment given to mentally ill persons is in large part dependent on their being able after discharge to reside in stable housing with available supportive services. A discharge to the street, to a congregate public shelter, or to a "flop house” would not constitute effective "rehabilitation” required to be given to such persons pursuant to section 7.07 (c) of the Mental Hygiene Law as these places are not appropriate residences for them in light of the dangers involved in such living arrangements.
The principal issues raised in the case at bar is whether the New York City Health and Hospitals Corporation (HHC) or any city agency has an obligation to see that dischargees from psychiatric hospitals operated by HHC obtain appropriate housing. The court finds that both HHC and the City of New York jointly have this obligation which has not been fulfilled, which failure is one of the root causes of the homeless crisis in our city.
These two actions were tried jointly. One was instituted against HHC, executives thereof, and the City Commissioner of Mental Health, Mental Retardation and Alcoholism Services (the municipal defendants), while the other names the Governor and the State Office of Mental Health (the State defendants).
The amended complaint against the municipal defendants is on behalf of the named plaintiffs and "all other homeless mentally ill persons who have been discharged or conditionally released from hospitals administered by the New York City Health and Hospitals Corporation without a 'written service plan’, an assurance of a residence and other after care services” in violation of the Mental Hygiene Law, the common law and constitutional guarantees of equal protection. It is asserted that "mentally ill persons * * * require an appropriate residence in order to benefit from a course of treatment and in order to avoid the recurrence of debilitating episodes of mental illness”. The relief sought is a judgment (i) declaring that defendants have violated duties owing to the plaintiffs in failing to provide each dischargee with a written service plan in compliance with Mental Hygiene Law § 29.15 (f) and (g), and have breached their duties of care owing to plaintiffs, and (ii) requiring defendants to comply with these statutory provi*260sions and to provide plaintiffs "with appropriate care and services in a non-discriminatory fashion”.
The complaint against the State defendants is similar except that compliance with subdivision (h) of section 29.15 is also demanded.
Subdivisions (f), (g) and (h) of Mental Hygiene Law § 29.15 provide:
"(f) The discharge or conditional release of all clients at developmental centers, patients at psychiatric centers or patients at psychiatric inpatient services subject to licensure by the office of mental health shall be in accordance with a written service plan prepared by staff familiar with the case history of the client or patient to be discharged or conditionally released and in cooperation with appropriate social services officials and directors of local governmental units. In causing such plan to be prepared the director of the facility shall take steps to assure that the patient to be discharged or conditionally released is interviewed, provided an opportunity to actively participate in the development of such plan and advised of whatever services might be available to him through the mental hygiene legal service.
"(g) A written service plan prepared pursuant to this section shall include, but shall not be limited to, the following:
"1. a statement of the patient’s need, if any, for supervision, medication, aftercare services, and assistance in finding employment following discharge or conditional release, and
"2. a specific recommendation of the type of residence in which the patient is to live and a listing of the services available to the patient in such residence.
"3. A listing of organizations, facilities, including those of the department, and individuals who are available to provide services in accordance with the identified needs of the patient.
"4. The notification of the appropriate school district and the committee on special education regarding the proposed discharge or release of a patient under twenty-one years of age, consistent with all applicable federal and state laws relating to confidentiality of such information.
"(h) It shall also be the responsibility of the director of any department facility from which a client or patient has been discharged or conditionally released, in collaboration, when appropriate, with appropriate social services officials and directors of local governmental units, to prepare, to cause to be *261implemented, and to monitor a comprehensive program designed:
"1. to determine whether the residence in which such client or patient is living, is adequate and appropriate for the needs of such patient or client;
"2. to verify that such patient or client is receiving the services specified in such patient’s or client’s written service plan; and
"3. to recommend, and to take steps to assure the provisions of, any additional services”.
It is acknowledged that the discharge planning mandates set forth in Mental Hygiene Law § 29.15 (f) and (g) apply to all mental health facilities in the State, while subdivision (h) only applies to facilities operated by the State Office of Mental Health (OMH). Prior to the adoption of Laws of 1980 (ch 341), discharge planning was only required in State facilities. That chapter, which amended subdivisions (f) and (g) to make such planning required in all mental institutions, did not alter subdivision (h).
The State acknowledges that, as a result of the implementation and monitoring requirements of Mental Hygiene Law §29.15 (h), it has an obligation to see that dischargees from psychiatric facilities operated by OMH obtain "adequate and appropriate” housing. It agrees with plaintiffs that public shelters are not appropriate places to send patients. Although the proof showed that there were instances where some of its patients did go to a shelter or other inappropriate residence, the court is satisfied that the number is not sufficient to warrant an "obey the law” type of injunction to be issued against it. (Cf., Grant v Cuomo, 134 Misc 2d 83 [Sup Ct, NY County 1986], mod 130 AD2d 154 [1st Dept 1987], affd 73 NY2d 820 [1988].) Moreover, the improper discharges basically resulted when patients left without leave, were released upon presenting a 72-hour letter demanding discharge as authorized by Mental Hygiene Law § 9.13 (b), were discharged by court order pursuant to Mental Hygiene Law § 9.31 (c), or refused offered residential recommendations.
Prior to the institution of this action, HHC hospitals did not employ any form providing for the information required to be set forth in a service plan under the provision of subdivision (g) of section 29.15. The HHC discharge plans consisted of notes scattered in various places in the patient’s hospital record. Thus, upon discharge there was no document that it *262gave to its patients containing all of the information required by that subdivision. The State, on the other hand, did have such a form that was in use in all mental health facilities that was given to patients when released. However, during the course of this litigation it appears that a standard form was devised by HHC.
The key legal issue in this case revolves about the fact that Mental Hygiene Law § 29.15 (h), requiring the implementation referred to above, only applies to State facilities. Thus the municipal defendants argue that: "their legal obligations do not extend to determining whether a former patient is living in an appropriate residence, to verify that he is receiving the services in the discharge plan, and to take steps to provide housing services. Only the state OMH facilities are to determine if the patient has a specific residence that is adequate and appropriate for the needs of the patient. All other hospitals need only recommend a specific type of residence”.
In support of their position that patients discharged from HHC hospitals should have the same benefits as those leaving State facilities, plaintiffs contend that (i) the statutory scheme is unconstitutional as depriving city dischargees of equal protection, and (ii) common-law rights to proper treatment of the mentally ill warrant municipal patients being provided postdischarge care, which includes an appropriate residence.
Although the municipal defendants maintain that there is a rational basis for this difference based on the fact that the State facilities generally treat the chronically ill, while HHC hospitals only deal with acute cases, the court finds that it need not reach that question because other statutory provisions demonstrate that HHC patients are to receive services similar to those required by section 29.15 (h).
Subdivisions (m) and (n) of section 29.15, added by the aforesaid Laws of 1980 (ch 341), provide:
"(m) It shall be the responsibility of the chief administrator of any facility providing inpatient services subject to licensure by the office of mental health to notify, when appropriate, the local social services commissioner and appropriate state and local mental health representatives when an inpatient is about to be discharged or conditionally released and to provide to such officials the written service plan developed for such inpatient as required under subdivision (f) of this section.
"(n) It shall be the duty of directors of local social services districts and local governmental units to cooperate with facili*263ties licensed or operated by an office of the department in the preparation and implementation of comprehensive written services plans as required by this section.”
The HHC hospitals, being subject to licensure by the State Office of Mental Health, are thus governed by these subdivisions and consequently are required "to cooperate” with the city Department of Social Services in the "preparation and implementation” of the discharge plans required under Mental Hygiene Law § 29.15 (f). Hence, more than merely giving a patient a piece of paper is required of HHC. Although subdivision (n) does not contain the specificity of subdivision (h), the court interprets the mandate of the two provisions to be similar insofar as concerns the issues before this court. Hence, HHC and the city have an obligation to see that the residences in which its discharged patients are living are adequate and appropriate to their needs. This conclusion is buttressed by the statement of legislative intent set forth in Laws of 1980 (ch 341, § 1):
"Statement of legislative intent. The discharge or conditional release from all inpatient facilities of those suffering from one or more mental disabilities is not necessarily an indication that the person is no longer in need of treatment or support services. Hospitalization to treat an acute episode or chronic illness is often only one segment of the spectrum of total care; provisions to ensure continuity of appropriate care in other settings must be established. Appropriate discharge planning lessens the chance or frequency of future hospitalization, which is both costly and restrictive.
"The legislature declares that the establishment of a policy requiring uniformity in the discharge planning process and coordination among inpatient facilities, whether operated by the state, a local government, or any other person, corporation or organization and certified by an office of the department of mental hygiene and adequate implementation of written discharge plans for after care services is in the best interests of mentally disabled persons and the citizens of New York state” (emphasis supplied).
Thus here, as in Klostermann v Cuomo (61 NY2d 525 [1984]), an agency of government has not satisfied a nondiscretionary duty imposed upon it by the Mental Hygiene Law. Hence, it is appropriate for this court to direct compliance.
Further, in a case in which the plaintiffs sought to require government to provide residential care to mentally ill home*264less persons not in need of hospitalization, our Appellate Division, in affirming a denial of a motion to dismiss the complaint seeking such relief, noted that the issue at hand "may very well constitute * * * 'extraordinary or emergency circumstances’ ” so that a court may act to grant the requested relief even though the issue would normally be considered one of policy committed to another branch of government. (Love v Koch, 161 AD2d 209, 211, rearg or lv denied NYLJ, July 16, 1990, at 26, col 1.) In light of the social emergency emanating from the homeless crisis in New York City as established at the trial of these actions, this court would, even if the statute were not interpreted as set forth above, direct that similar relief be granted.
Although the State funds certain community residences for former psychiatric patients, it is recognized by all parties that at present there are not sufficient residences available in the City of New York in which to place all homeless discharged patients. Further, it is understood that it is particularly difficult to place drug and alcohol abusers, and if patients are not discharged from HHC hospitals until a residence is located, beds are blocked and hence unavailable for persons in need of admission. It is noted that HHC mental facilities are operating at approximately 98% of capacity.
In light of the shortage, the city and State entered into an agreement dated August 22, 1990 to create 5,225 beds for homeless mentally ill individuals through June 1992. Although plaintiffs agree that this is a step in the right direction, they contend that it will create only half of the number of beds now needed for this class of persons and, moreover, there is no guarantee (without a court order) that the funds necessary to fully implement the agreement will be appropriated.
Consequently, in the action against the State defendants, the judgment to be settled shall contain a declaration that they are not in violation of their obligations under Mental Hygiene Law § 29.15, and the action against them shall be otherwise dismissed. In the action against the municipal defendants a judgment shall be settled declaring that HHC has violated the aforesaid obligations with respect to discharge planning under Mental Hygiene Law § 29.15 (f), (g), (m) and (n), and requiring compliance. However, in view of the fact that there is not now in existence sufficient available housing to enable HHC to immediately fully comply, the judgment shall provide for implementation over a period of time. Sug*265gestiops as to the appropriate time period for compliance shall be submitted with the proposed judgment.
It is noted that neither the City of New York nor its Department of Social Services is a party defendant in either action. Since section 29.15 (n) states that it is the duty of "local governmental units” and the "directors of local social services districts” to cooperate in the "implementation” of the discharge plans, it would be helpful in order to give full effect to this decision that the City of New York and its Department of Social Services be added as party defendants so that the judgment may also be directed against them. Accordingly, the court would urge the Corporation Counsel, who represented all of the municipal defendants named in the complaint, to consent to such addition unless there is any perceived prejudice. If the amendment is not agreed to, leave is granted to plaintiffs to move for such relief.