Mr. Peters had produced numerous investigative reports that exposed significant failings in city agencies that were highly embarrassing to Mr. de Blasio, including lapses in performing lead paint inspections at the New York City Housing Authority, and the lifting of deed restrictions on a Lower East Side nursing home that permitted its sale to a developer of luxury condominiums.

Mr. de Blasio on Friday said those investigations did not influence his decision.

“D.O.I. is meant to be critical of city agencies,” Mr. de Blasio said at a news conference, before delineating the “mistakes and abuses of power” detailed in the independent report on Mr. Peters. “The D.O.I. commissioner is supposed to be the most pristine of all.”

Mr. de Blasio said that he was not influenced by any continuing investigations. Mr. Peters had begun an investigation into whether City Hall sought to influence a review of the educational quality at some Jewish religious schools.

He also said, however, that he regretted hiring Mr. Peters in the first place.

Mr. Peters said in a brief statement that he would issue a fuller written response to his firing in coming days. He said that under his direction the department “exposed corruption and misconduct and forced serious systematic reforms in multiple agencies.”

But in an email to his staff sent about two hours after he was fired, Mr. Peters suggested that the mayor fired him to prevent him from carrying out investigations.