The Bloomberg administration on Friday withdrew its controversial proposal to remove homeless families from the shelter system for 30 days, placing their children in foster care, if they do not actively look for apartments — and an historic agreement between the city and the Legal Aid Society was born.

The agreement was one of the terms of a settlement of the longstanding McCain case — first filed by the Legal Aid Society against the Koch administration 20 years ago — which led to court orders requiring that the city provide housing, assistance and services to homeless families.

In settling McCain, the city and Legal Aid agreed to a system that, for the next two years, will attempt to move policy debate and oversight out of the courtroom and into the hands of a panel of three Special Masters. Those masters, whom both sides agreed on, will be responsible for regular evaluation of the city homeless services system. They will make periodic reports and recommendations on the city’s homeless policy to State Supreme Court Judge Helen Freedman. They also have the authority to hear legal claims, should they need to mediate disagreements between the city and Legal Aid.

“We’ve come up with a method where Linda [Gibbs, commissioner of the Department of Homeless Services] can run the agency, and help those who need help, assuring the public that their money is well spent,” said Mayor Bloomberg an hour after Judge Freedman signed the agreement. “And if advocates don’t agree [with what the city is doing], they have the panel to go to.”

The goal, all parties agreed, is to cut down on litigation time while providing shelter to families.

In modifying its motion to sanction families that linger in the shelter system, the city plans to hold such families responsible by handing them the keys to an apartment that meets code requirements and is the right size for that family. If the family refuses to sign that lease, said Gibbs, “they can’t return to the Emergency Assistance Unit again.”

Legal Aid attorney Steve Banks did not argue. “As long as they are being referred to an apartment that meets standards … that’s housing that’s been lawfully provided by the city,” he said. Everyone’s goal, said Banks, is that “families should be kept together and that they should have a roof over their heads.”

As of Friday, the newly appointed Special Masters were not sure how they will fulfill their oversight role. “We’ll have to start figuring that out tomorrow,” said Gail Nayowith, executive director of the Citizens’ Committee for Children of New York, a child welfare advocacy group. She is joined on the panel by John Feerick, former dean of Fordham University School of Law, where he now teaches. He has served on several oversight committees, including the New York State Commission on Government Integrity, and has been president of the Citizen’s Union Foundation and chair of the Fund for Modern Courts.

Daniel Kronenfeld, the third member of the panel, served as executive director of Henry Street Settlement from 1985 to 2002. Before that, he helped found and direct the Settlement’s Urban Family Center, the city’s first transitional shelter for homeless families. He currently serves on the board of the Settlement Housing Fund, Citizens’ Committee for Children and other groups.

The panelists have been working with Legal Aid and Bloomberg administration officials since Thanksgiving on the negotiations — which ended with the settlement early Friday morning.

While the settlement only applies to homeless families, advocates for homeless single adults hope it is a good sign for their clients. In October, the Bloomberg administration asked the court for permission to sanction homeless adults by removing them from the shelter system for a month if they fail to seek permanent housing. The state court of appeals is expected to hear that case, called Callahan, in mid-February.

“We’re very pleased with today’s settlement,” said Patrick Markee of the Coalition for the Homeless, the plaintiffs in the Callahan case. “I am hopeful that with a new beginning there will be room to discuss issues with regard to homeless adults.”