The mayor and some of his aides came under investigation last year for a variety of activities, including allegations of pay to play and possible violations of campaign fund-raising rules. In March, federal and state prosecutors said they had decided not to file criminal charges, although they raised questions about the ethics of some of the mayor’s actions.

Some of the investigations looked at whether the mayor had done favors for donors who made contributions to his political campaign or a nonprofit group he created to support his policies. Another focus of the investigations was whether laws were broken during a fund-raising push aimed at electing Democrats to the State Senate in 2014 (Mr. de Blasio cited the State Senate effort as an example of the nongovernmental work for which lawyers’ fees would be paid from a legal-defense fund.)

Mr. de Blasio had previously been emphatic in saying that no city money would go to pay his legal fees — although public money was used to pay private lawyers hired by the city for some of his aides.

“I do want to ask everyone to accurately report the fact that all legal efforts on my behalf are not paid for by the taxpayer, as opposed to other city employees,” he said at a news conference in February. “That’s the reality, but the bottom line is, no public dollars are going into the legal work on my behalf.”

But in March, the city’s Conflict of Interest Board ruled that donations to a legal-defense fund should be treated as gifts to the mayor and would be capped, in most cases, at $50. That made it extremely difficult for Mr. de Blasio to raise the millions of dollars needed to pay all his legal bills.