NEW YORK (AP) — The head of the New York City department of buildings resigned on Thursday amid reports that he was being questioned by prosecutors as part of an investigation into illegal gambling.

Fabien Levy, press secretary to Mayor Eric Adams, said in a statement that Eric Ulrich had “tendered his resignation as DOB commissioner in an effort to, in his words, avoid ‘unnecessary distraction for the Adams administration.’”

Ulrich, a Republican former City Council member, had served as city buildings commissioner since Adams, a Democrat, appointed him to the post in May.

“We have accepted his resignation, appreciate him taking this step, and wish him well,” Levy said.

The New York Times reported that investigators from the office of Manhattan District Attorney Alvin Bragg questioned Ulrich as part of an illegal gambling investigation and seized his phone on Tuesday.

The Times said the scope of the investigation was not clear. A spokesperson for the district attorney’s office declined to comment.

As buildings commissioner, Ulrich, 37, led the department that enforces building codes, issues permits and responds to structural emergencies in a city with more than a million buildings.

Ulrich earlier represented a Queens district on the City Council, first winning his seat in a special election in 2009.

While on the council, he reported to the city’s Conflicts of Interest Board that he had won between $5,000 and $47,999 gambling in 2015, the Daily News reported.

Efforts to reach Ulrich for comment on Thursday were not successful. Two phone numbers listed for him were not in service.