In an unexpected shake-up of a major city agency, Mayor Vincent C. Gray named a veteran public housing official Monday to oversee his administration’s affordable housing efforts.

Michael P. Kelly will return to D.C. government as director of the Department of Housing and Community Development, less than three years after resigning from the D.C. Housing Authority, which he led for nine years.

After leaving the District, Kelly was general manager of the New York City Housing Authority for a year before being tapped by the Obama administration to lead an overhaul of the troubled Philadelphia Housing Authority, which is under federal receivership.

Kelly, who was not available for comment Monday, cited “personal reasons” Friday when he commented about his departure to the Philadelphia Inquirer. “I’m going back to Washington,” he told the paper.

Kelly, 58, was seeking to return to the District for family reasons, according to several officials with knowledge of the move. He co-owns a home in the Takoma neighborhood, and his wife and children have remained in the city.

His wish to return meshed with Gray’s desire to move more aggressively on affordable housing measures, according to two administration aides with knowledge of the shake-up. At a citizens summit hosted by the mayor in February, Gray (D) rated affordable housing as the top priority in city government, easily trumping education, crime and other concerns.

Gray said in a statement that affordable housing is “an issue of utmost importance to a large percentage of District residents, and addressing that issue is a priority for my administration.”

Kelly will start July 2 and make $165,000 a year, Gray spokesman Pedro Ribeiro said. He was paid $225,000 a year in his Philadelphia position, according to media reports.

John E. Hall, the agency’s current director, will become a senior adviser to Victor L. Hoskins, Gray’s deputy mayor for planning and economic development. He will keep his current $140,000 salary, Ribeiro said.

Hall, a former federal housing official who was hired by Gray in April 2011, was “more suited” for the senior adviser position in the deputy mayor’s office, a mayoral aide said. The administration said in a statement that Hall will focus on creating a five-year plan for affordable housing and establishing a system to track its production. Hall did not return a call seeking comment.

Robert Pohlman, executive director of the Coalition for Nonprofit Housing Economic Development, said Hall had to oversee the agency’s compliance with U.S. Department of Housing and Urban Development guidelines for housing grants, an inherited problem that became overwhelming. A Washington Post investigation found mismanagement and waste of federal funds dating to before Hall’s tenure; HUD and the city recently agreed to an improvement plan.

“He was really absorbed in addressing those compliance issues,” said Pohlman, a former director of the agency.

He said a Department of Housing and Community Development director has to balance the day-to-day operations of the agency, the needs of the community and the politics of the D.C. Council.

“Coming to the District of Columbia is more than a notion. Agency heads have a great deal of difficulty adjusting,” he said. “Michael Kelly certainly has a lot of experience and knows the other housing agencies well. He knows the council, and he knows HUD.”

The Princeton-educated Kelly led housing authorities in San Francisco and New Orleans before coming to the District in 2000. He clashed with then-Mayor Adrian M. Fenty (D) in the months before his resignation from the D.C. Housing Authority. A Kelly deputy, Adrianne Todman, replaced him.

He subsequently won plaudits in Philadelphia, where he took over an agency whose previous executive director resigned amid allegations that he had sexually harassed several colleagues, secretly settling lawsuits filed against him.

Mark McDonald, a spokesman for Philadelphia Mayor Michael A. Nutter, said Monday that Kelly “did a very good job at bringing stability” to the troubled agency. “Real progress was made in many different areas,” he said.

The D.C. Council must confirm Kelly’s appointment. Michael A. Brown (I-At Large), who chairs the council’s housing panel, praised the move. “I think we should be happy that somebody like Michael Kelly is coming back in a more expansive role,” he said. “And I’m glad John Hall will be part of the team.”

Hall had a heavy lift as an outsider coming into an agency rife with problems, said Jim Dickerson, founder and chairman of Manna Inc., an affordable housing nonprofit organization.

Kelly, he said, brings experience. “Michael knows this. He’s been here. He’s deeply committed,” Dickerson said. “We hated to see him go. He was great, and we’re delighted to see him come back.”