The city’s chief legal officer, Zachary W. Carter, is retiring after having served nearly six years as New York’s corporation counsel, Mayor Bill de Blasio announced on Friday.

De Blasio said that Carter, 69, planned to officially step down from the post at the end of August. Georgia Pestana, the agency’s first assistant corporation counsel, will serve as acting corporation counsel, as the city launches a national search for Carter’s replacement.