A sheriff's deputy died Saturday after he was shot in the head while responding to a shooting in the southwestern part of the city, authorities said.

Officers responded to a call early Saturday and found the driver of a truck who had been beaten and shot at least once in the head. The man's wounds were not life-threatening, the sheriff's office said.

Officers began questioning at least a dozen people at a party at a nearby house, said Sgt. John Urquhart. King County Deputy Steve Cox was interviewing people in a back bedroom, Urquhart said, when a shot was heard. Two deputies moved toward the back of the house and were fired upon. At least one officer returned fire and they rushed into the room.

The gunman had been shot and killed. Deputies found Cox with a gunshot to the head. He later died at a hospital. The gunman was not identified.

Cox was a nine-year veteran of the department. He was married with a young child, Sheriff Sue Rahr said.

"It's been a very gut-wrenching morning for all of us," Rahr said.