Mayor Muriel E. Bowser (D) on Tuesday officially closed D.C. General, a former hospital that had been used as a megashelter for homeless families since 2001.

A warehouse of the city’s destitute and forgotten at the east end of Capitol Hill, D.C. General became notorious after 8-year-old Relisha Rudd disappeared from the shelter in 2014. Residents and their advocates had long complained about poor living conditions and safety concerns for the city’s most vulnerable children, but the girl’s disappearance brought widespread attention.

The closure marked delivery on a campaign pledge Bowser had made when she first ran for office in 2014. She vowed to shutter D.C. General and replace it with a network of seven smaller shelters across the city that she said would be more dignified and humane.

“We embarked four years ago on closing D.C. General. We all believed it was too big, too run-down, too isolated to serve families who need emergency shelter,” said Bowser, who watched an official bolt the door to the main entrance of the hospital. “Now the last family has moved out of the facility.”

At its peak, the D.C. General shelter housed as many as 250 families — about 1,000 people — but stopped accepting new families in May.

The last two families to occupy the dilapidated hospital left Monday.

Since July, 170 families have moved out of D.C. General, according to data kept by the Department of Human Services.

More than half of them found new apartments using temporary one-year vouchers from the city, 33 were placed in other shelters and nine were terminated from receiving city assistance for rule violations.

“We are really happy we didn’t have to move a group of people en masse to hotels,” said Laura Zeilinger, director of the Department of Human Services. “We were really successful in addressing the specific needs of each family in making sure they got to a place that was appropriate based on their specific circumstances.”

Two of the seven replacement shelters that make up the mayor’s plan opened in the last month, in Wards 4 and 7. As of Tuesday, six families were living in the Ward 4 shelter and 14 families in the Ward 7 facility. The Ward 8 shelter is expected to open next month after construction delays. Shelters in Wards 3, 5 and 6 are planned to open next summer, while a building in Ward 1 is projected to be completed by 2020.

District officials hope modern shelters with fewer families and more amenities such as bathrooms with locks will improve safety and prevent a repeat of D.C. General’s failures.

Demolition of D.C. General is set to begin next summer, said Greer Gillis, director of the Department of General Services.

Administration officials have declined to say what they plan to do with the public land in a part of Southeast Washington that has become a magnet for new development.

The mayor first pitched her plan to close D.C. General in 2016 but it hit repeated stumbling blocks, including allegations of cronyism, construction delays and an ongoing probe by the D.C. inspector general.

The D.C. Council overhauled Bowser’s original plan, to lease property from private landowners, some of whom were her campaign donors, and instead require the city to use public land for the shelters.

Several neighborhood groups fought the arrival of new shelters in their communities, insisting their concerns were about procedure and not living near the homeless. A zoning challenge to a planned shelter in Ward 3, the wealthiest part of the city, recently failed.

Advocates for the homeless recently objected to the mayor proceeding with plans to close the shelter before all the replacement facilities were ready and starting demolition on the hospital campus before families moved out. They raised more alarms when crews discovered lead at a demolition site several hundred feet from the building where families live. Bowser administration officials insisted there was no threat to public safety.

Bowser has dismissed criticism of her administration’s handling of homeless families, and celebrated the recent opening of shelters in Wards 4 and 7 with ribbon-cuttings.

There was once similar optimism at the 2007 closure of the emergency shelter at D.C. Village, which officials also derided for “inhumane” conditions.

But families didn’t fare better at D.C. General. A 2014 investigation by The Washington Post found repeated complaints about staff members propositioning residents for sex and poor living conditions ranging from pest infestations to inconsistent hot water.

“It’s been complicated,” Bowser said Tuesday of the shelter’s closure. “It’s been fraught with a lot of political debate, some of it not so nice. We have endured lawsuits that we have won, that we’ve been successful in. . . . We as a city have said we don’t want to lose another child. We want families who are experiencing emergencies to have a safe place to land so they can take care of employment, take care of health, take care of training and provide a better life for their families.”