The shooting in Harlem started after a fight broke out at a crowded party that had spilled from a park into the streets on Sunday morning. When it was over, 50 bullets had been fired, one man was dead, and six others, including two police officers, were wounded.

Forty-six of the bullets were fired by four police officers; about 20 or so apparently struck a man who the police said had fired at officers after fatally shooting a man. He was expected to survive. The two wounded officers were not seriously hurt; one of them, who was in a plainclothes unit, had been shot in the chest by another officer. The wound was superficial, but could have been far worse had the bullet not struck the officer’s bullet-resistant vest. Police officials said that shooting probably resulted from an errant bullet, not a case of mistaken identity.

Three more people, believed to be bystanders, were also hurt, although it was unclear who fired those shots.

Police officials said the officers’ use of force appeared to be justified. Paul J. Browne, the Police Department’s chief spokesman, said that one or more of the five responding officers had seen Angel Alvarez, 23, fatally shoot Luis Soto, 22, and that Mr. Alvarez had begun the gunfight with the police.