The end came at Gracie Mansion, where Mayor Bill de Blasio, his wife and her top aide gathered on Sunday to discuss a decision none of them had wanted to make.

After months of damaging reports — about ethics lapses, unpaid parking tickets, a boyfriend with a serious criminal past — Rachel Noerdlinger, the chief of staff to New York City’s first lady, Chirlane McCray, was at the end of her rope. Her 17-year-old son had been arrested over the weekend. A controversy on the verge of fading was heating back up.

Ms. Noerdlinger, after what friends described as hours of agonizing, told the mayor and his wife that she needed to step down. On Monday, she announced that she would take an indefinite leave of absence — the first significant shake-up of the mayor’s 321-day-old administration, and, for Mr. de Blasio, a dismaying turn weeks after declaring the matter “case closed.”

The departure of Ms. Noerdlinger ends a situation that had been a persistent distraction for Mr. de Blasio, a Democrat, as he sought to pursue the political goals of his first year in office. And it takes a troublesome story line out of the headlines as the mayor gears up for a year-end review of his accomplishments and renews his advocacy for liberal politics on the national stage.