The city’s longtime sanitation commissioner has resigned from his job after a winter that tested his skills running the agency.

The mayor’s office confirmed on Friday that Sanitation Commissioner John Doherty had tendered his resignation.

Doherty served a decades-long career at the agency, rising in the ranks from a first job as a sanitation worker in 1960 to lead the agency. Mayor Michael Bloomberg appointed him commissioner in 2002.

Mayor Bill de Blasio said his administration was fortunate to have Doherty’s experience and skills through its first weeks.

“[Doherty] has exhibited leadership, competency and tenacity for New York City in the most challenging times,” de Blasio wrote. “He has never failed to persevere in the most trying situations.”

This past winter proved particularly challenging for the Department of Sanitation, the largest in the world.  A series of back-to-back snowstorms tested the agency’s ability to clear streets while also continuing to collect the tens of thousands of tons of refuse generated by the city each day.