An off-duty city police officer responding to a woman’s screams during a violent assault in a Queens home on Sunday night was shot in the left hand as he struggled with the man assaulting her, the police said. The man was also hit once as the two men grappled for the officer’s gun, the police said.

The officer and the woman, who suffered lacerations to the head and required at least nine stitches, were taken to Jamaica Hospital Medical Center in stable condition, the police said. The man, identified by the police as Jose Bernazard, 40, was also taken to Jamaica hospital where he was listed in critical condition.

The violent episode erupted around 10 p.m. on a residential block of Jamaica. The officer, Joseph Koch, 29, had been attending a barbecue at the home of his fiancée’s father when he heard what sounded to be a woman screaming “Don’t kill me” from a nearby home, said Paul J. Browne, the Police Department’s chief spokesman.

As Officer Koch rushed in the direction of the two-story white house at 144-22 South Road, he saw a young boy roughly 10-years-old yelling, “He’s trying to kill my mother,” Mr. Browne said.