A New York narcotics detective who was shot while conducting a search warrant has recovered from surgery and was discharged from the hospital, authorities said.

Dominick Libretti, a 10-year veteran of the NYPD, who was shot in the leg Jan. 20, was discharged Monday from Staten Island University Hospital to the applause and cheers of his colleagues and hospital staff, a video posted by the police department shows.

The narcotics detective was searching the home of Anthony Marshall, 40, last month when he suffered a "possibly career-ending" gunshot by Marshall's roommate, Nelson Pizarro, 39, NYPD Chief of Detectives James Essig said during a press conference the day of the shooting. 

The warrant was issued by the Staten Island District Attorney’s Office as part of a long-term drug investigation, authorities said. 

THIRD NYC OFFICER SHOT THIS YEAR, IN STATEN ISLAND DRUG RAID

Pizarro has seven previous convictions in New York, including aggravated license, criminal possession of a controlled substance, and reckless endangerment, officials said. 

NYPD CRIME STOPPERS - Below is a picture of the gun the suspect used that struck our detective  Staten Island  (NYPD CRIME STOPPERS )

NEW YORK CITY 11-MONTH-OLD SHOT IN FACE, POLICE SAY 

NYPD Commissioner Keechant Sewell, who also spoke at the Jan. 20 press conference, highlighted the bravery of New York law enforcement officers after three officers were shot in January.

BROOKLYN, NEW YORK, UNITED STATES - 2020/07/12: Pro-cop protesters carryng a Blue Lives Matter flag at a march in Bay Ridge, Brooklyn. (Photo by Erik McGregor/LightRocket via Getty Images)

CLICK HERE TO GET THE FOX NEWS APP

Officer Kaseem Pennant, 27, was shot in the right leg on Jan. 18, during an altercation with a 16-year-old suspect. He subsequently recovered and was released from St. Barnabas Hospital the following morning, officials said. 

"These deadly illegal guns, no, no neighborhoods," the commissioner continued. "It's officers we witnessed today that I am sincerely grateful to for their bravery, their courage and their willingness to continue to make every effort to keep this city safe. And they need and deserve the support to do it."