The incident happened at 633 Halsey Street in the Bedford Stuyvesant section of Brooklyn just after 8:00 on Saturday night.
Police originally responded to a call of a domestic dispute of a son assaulting his mother.
While at the location, the officer was holstering his weapon when it accidentally discharged, and shot him in the leg.
At the time, there was a block party going on in the neighborhood, so there were many people walking around. No one else was injured.
"I was at the block party, and I saw police come from all over," said eyewitness Eddie Williams.
Investigators are still trying to piece together what happened, and are questioning witnesses.
The officer is in stable condition at Kings County Hospital.