The director of the D.C. Department of Human Services, tapped by Mayor Anthony A. Williams two years ago to transform one of the District's most beleaguered bureaucracies, is leaving the post to become the health and human services chief in Montgomery County, officials said yesterday.

The sudden resignation of Carolyn W. Colvin, who had said that she wanted to stay on for five years to stabilize a department that was in turmoil for much of the last decade, stunned District officials. The department, one of the largest with a $441 million budget and a workforce of more than 2,000, runs key programs, including welfare, juvenile justice and homeless services.

"I'm in a state of shock," said D.C. Council member Sandy Allen (D-Ward 8), who heads the council's Committee on Human Services. "I have no idea where we go from here."

Colvin's departure presents a major challenge for Williams, whose goal of making agencies more competent and accountable has often been stymied by the difficulty of finding and keeping respected managers. Williams learned of the decision Tuesday evening, and top managers at the department were told at a staff meeting yesterday afternoon.

"Carolyn has done a good job, trying to move the department forward against very tough and sometimes, it seems, insurmountable obstacles," Williams said.

Colvin starkly described the challenges she faced during what she called an "extremely difficult" two years. "I don't think any investigation I made prior to coming aboard could have prepared me for the level of challenge," said Colvin, 60. "There are years of neglect in this department."

She said that trying to turn the department around was exhausting. "Because you're dealing with so many infrastructure issues, you really can't be as innovative and creative as you'd hoped," she said. "You're plugging the dike, trying to prevent or respond to crisis after crisis."

Her reform efforts were frustrated by the city's cumbersome personnel and procurement systems, Colvin said.

Colvin said she wished she had had more time to work with community organizations and to reach out directly to clients. "What I was not afforded here was the opportunity to do a lot of those external things, because I got mired down with the level of dysfunction internally within the organization," she said.

When Colvin was appointed in February 2001, city officials described her as a savior for the department. Colvin served as Maryland's secretary of human resources from 1989 to 1994 and then as a deputy commissioner of the Social Security Administration.

While city officials lamented Colvin's departure, their counterparts in Maryland expressed elation. Montgomery County's Department of Health and Human Services has not had a permanent director since Charles Short retired last year. "She brings a lot of strengths to the job . . . She's got local, state and federal experience, and she is a strong administrator," said County Executive Douglas M. Duncan (D). "We're fortunate to get her."

Colvin leaves a mixed record in the District. Her department last year won $24.2 million in federal bonuses for its progress in moving welfare recipients into the workforce and for the steady reduction in the District's out-of-wedlock birthrate. The city also won accolades for expanding the range of city-funded child care programs.

But other social service programs were criticized during her tenure. The city's mental retardation and juvenile justice agencies continued under judicial supervision because of class-action lawsuits over the care of the disabled and of children in trouble with the law.

Colvin's predecessor, Jearline F. Williams, was ousted in early 2000 after an outcry over financial exploitation and unreported deaths in the mental retardation program.

Duncan has praised Montgomery's Department of Health and Human Services as one of the most innovative agencies in the country. But department employees have told union leaders that they are overburdened with cases and paperwork.

D.C. Deputy Mayor Carolyn N. Graham, who oversees human services, said the administration will start a search for a new director after Colvin leaves by the end of March. Staff writer Michael H. Cottman contributed to this report.