The man shot and killed by police Thursday afternoon at Eighth and Market streets in downtown San Francisco during an alleged struggle over a sergeant’s gun was identified as Herbert Benitez, the city medical examiner said Friday.

Benitez, 27, of San Francisco was shot when two police sergeants went to arrest him for throwing bottles in the road and he attempted to grab one of their firearms near U.N. Plaza, Police Chief Greg Suhr said.

The medical examiner’s office said that Benitez died from gunshot wounds to the torso and that his relatives had been notified.

The two sergeants involved in the shooting, both described by Suhr as department veterans, have been placed on routine paid administrative leave while the incident is investigated, police officials said Friday.

Investigations into the shooting were being conducted by the Police Department’s internal affairs and homicide units as well as the district attorney’s office and the Office of Citizens’ Complaints, officials said.

Relatives of Benitez could not be reached for comment.

The incident began just after noon Thursday when a construction worker flagged down the two sergeants and an officer who were driving southbound on Eighth Street near Market Street, Suhr said. The worker complained that Benitez had been throwing glass bottles near the construction site, Suhr said.

As the two sergeants, both working out of the Tenderloin Station, went to arrest Benitez, a struggle ensued and the man ended up on top of one of the sergeants and started grabbing his gun, Suhr said.

“He’s getting my gun! He’s getting my gun! He’s got my gun! Shoot him!” the sergeant called out to his partner, according to Suhr.

At that point the unengaged sergeant pulled out his service weapon and fired twice, killing Benitez, Suhr said.

Both sergeants were treated at San Francisco General Hospital for minor facial injuries, Suhr said.

A witness, who declined to give his name, gave an account that was similar to Suhr’s. The suspect “got on top of the sergeant and started whipping his ass,” the man said. Asked if Benitez had gone for the officer’s gun, the witness nodded affirmatively.

Construction worker Calvin Marksman, 32, said of the man who was shot, “I saw him actually die. It was pretty bad.” He said he watched emergency workers administer CPR and place an oxygen mask over the dying man’s face.

Kale Williams is a San Francisco Chronicle staff writer. E-mail: kwilliams@sfchronicle.com Twitter: @sfkale