The overflowing shelter at the former D.C. General Hospital became a symbol of the Gray administration’s struggle to address family homelessness. (Sarah L. Voisin/The Washington Post)

The District government official who led the much-criticized response to the city’s recent homelessness crisis will leave his post in the coming months, Mayor Vincent C. Gray’s office said Thursday.

As director of the D.C. Department of Human Services, David A. Berns oversaw an effort to tightly integrate the city’s welfare, nutrition, housing and other social services programs, winning accolades for the work. He also won praise for his candor with the media and with advocates for low-income residents and the homeless.

But he was Gray’s deputy most visibly in charge of homeless services as a number of families seeking shelter this past winter more than doubled, and the city faced withering criticism over its handling of the influx.

In a statement thanking Berns for his service, Gray acknowledged those controversies. “David has faced major challenges in his time as DHS director, and he has responded each time with thoughtfulness, expertise, compassion and the ability to execute a plan,” the mayor said, adding that Berns “vastly improved” city programs for the needy.

Berns, who could not be immediately reached Thursday afternoon, is leaving to “spend more time with his family in Michigan,” the statement said.

While Gray hailed Berns’s efforts to create an “integrated service and unified intake model” for social service programs and highlighted his work to redesign the city’s welfare program, Berns most often commanded public attention as the city’s efforts to house homeless families struggled to meet the demand.

Under Berns, the department last year did not effectively clear out the city’s main homeless family shelter, at the former D.C. General Hospital, before cold weather triggered a city law requiring the District to house those who turn to the city for shelter. With D.C. General full, the District was forced to rent hundreds of motel rooms for homeless families. More than 350 remained in such temporary quarters as of late last month, at a staggering cost to the District.

Gray’s administration this year also halted the longstanding practice of housing homeless families for the duration of “hypothermia season,” leaving scores of families to sleep in temporary cots set up in recreation centers. Several families sued the city this spring and won, saying the accommodations did not comply with District law.

At times, Berns’s candor in public hearings complicated the administration’s message. Berns called D.C. General a “dead” building and said it should be closed as a city homeless shelter. And at a February hearing, he said of the city’s problem with housing homeless families, “It sounds bad, and it’s worse than it sounds.”

The announcement of Berns’s departure comes a third of the way through a 100-day sprint that Gray announced during his reelection campaign to move 500 families out of D.C. General and motel rooms and into more permanent living arrangements by early July.

Berns will leave June 28, before the 100 days is complete.

He becomes the third official to leave the mayoral cabinet since Gray’s April 1 primary loss, joining transportation director Terry Bellamy and Nicholas Majett of the Department of Consumer and Regulatory Affairs.