An NYPD detective is expected to recover after he was shot in the leg while executing a narcotics warrant in a Staten Island home on Thursday morning, police said.

The firefight erupted shortly after 6 a.m., as a group of officers burst into the Rockne Street home in New Springville to arrest a suspected drug dealer. When they got to the second floor, the man’s roommate fired from behind a bedroom door, striking the detective in the right leg, according to NYPD Commissioner Keechant Sewell.

The detectives returned fire, also hitting the suspected shooter, Nelson Pizarro, in the inner thigh, police said. Both men were hospitalized and are expected to recover.

The incident marks the third shooting of an NYPD officer since the start of this year, amid a spate of violence that included the shooting of an 11-month-old on Wednesday night. At a press conference Thursday, police officials blamed the proliferation of illegal guns on New York City streets.

“In less than three weeks, we’ve been in East Harlem, the Bronx and Staten Island,” said Sewell, referring to the shooting of an off-duty officer in his car on New Year’s Day and another shooting of an officer during an arrest on Tuesday. “These deadly, illegal guns know no neighborhoods."

The newly-minted police commissioner also praised the “heroism” of the Staten Island detective, who she said managed to hold a ballistic shield that protected other officers from gunfire after he was shot

Mayor Eric Adams, who was scheduled to deliver remarks for the United States Conference of Mayors in Washington D.C. on Thursday, did not attend the conference.

The latest gunfire came as a team of narcotics officers were attempting to arrest another man, Anthony Marshall, for distribution of crack and cocaine. Pizarro was not named in the warrant, but was known to police as a drug dealer, according to Chief of Detectives James Essig.

“They’re not nickel and dime players out there,” Essig said. “They’re dealing major weight.”

Marshall was arrested for drug charges, and two other women inside the house were taken into custody on unspecified charges, police said. A 9mm beretta handgun was recovered at the scene.