WASHINGTON (Reuters) - The nation's capital regained control of its mental health system on Thursday when a federal judge approved a settlement in a 37-year-old class-action lawsuit, the mayor's office said.

The District of Columbia's mental health system had been under court supervision since patients at St. Elizabeth's Hospital, Washington's psychiatric center, accused the capital in 1974 of not providing enough community-based mental health services.

Under the settlement approved by U.S. District Judge Thomas Hogan, the District is committed to adding 300 affordable housing units and to expanding job services for adults with mental illness, the office of Mayor Vincent Gray said.

The District also will boost treatment services for children in the home and the community.

"This is an historic day in the District of Columbia, and this settlement affirms the significant progress we have made in building a high-quality, community-based mental health system," Gray said in the statement.

At the time the suit was filed, St. Elizabeths had more than 3,600 patients. It now has less than 300, and more than 20,000 District residents get community-based mental health treatment.

(Reporting By Ian Simpson; Editing by Greg McCune)