SAN FRANCISCO — Two Alameda County sheriff’s deputies are under investigation by the Sheriff’s Office for beating a suspect with their batons dozens of times in a San Francisco alleyway this week, authorities said Saturday.

The unnamed deputies chased the suspect, identified as Stanislav Petrov, from San Leandro to San Francisco early Thursday, where he crashed a car and ran into a Mission district alleyway, sheriff’s Sgt. Ray Kelly said.

Surveillance footage a witness gave the San Francisco Public Defender’s Office shows Petrov stop in the alleyway near Clinton Park and Stevenson Street. He is then tackled by a deputy, who holds him down as a second deputy strikes him repeatedly with a police baton. Petrov was hit about 30 times, sometimes while on the ground and other times while kneeling as the officers can be heard shouting, “Get on the ground.”

The Public Defender’s Office released the video to news outlets and posted it to YouTube. The footage from the motion-activated camera includes audio and, at some points, stops.

“You see a shocking and brutal attack on a man that appears not to be resisting,” said Tamara Aparton, a Public Defender’s Office spokeswoman. “It’s dismaying to see him lying there bleeding and calling for help and not getting it for a while.”

It all began at about 1:30 a.m. Thursday as police patrolling a motel in the 17200 block of Foothill Boulevard in San Leandro spotted a stolen 2015 Mercedes, Kelly said. As police tried to stop the driver, he sped toward a deputy, hitting a patrol car and pushing it into a deputy. The deputy was injured, authorities said.

The driver, identified as Petrov, rammed a second patrol car before leading police on a chase along Interstate 580 through Oakland and across the Bay Bridge into San Francisco, Kelly said. During the 40-mile pursuit, Petrov hit speeds of 100 mph. The car chase reportedly ended when Petrov hit a parked car in the Mission district and took off on foot.

Police later found a loaded gun in the stolen Mercedes, Kelly said. Petrov was taken to a hospital to be treated for injuries.

“We are obviously concerned about what’s depicted in the video,” Kelly said Saturday. “We ordered an immediate investigation.”

The Sheriff’s Office is investigating whether either deputy captured the confrontation on body cameras. Deputies are issued body cameras and encouraged to activate them, but department policy allows individual deputies to decide when to turn the cameras on.

Authorities did not release the names of the deputies or how long they have been with the Sheriff’s Office. It’s possible they could be put on administrative leave or reassignment as a result of the investigation, which is in its early stages, Kelly said.

The San Francisco Public Defender’s Office likely will not handle the case because it involves a police agency out of its jurisdiction, and Petrov is being held at Santa Rita Jail in Dublin. But on Saturday, Aparton called for an independent investigation into the matter.

“Any time there’s a question of police misconduct it’s always better to have an independent investigation,” she said. “An agency investigating itself historically hasn’t proved to be that effective.”

Petrov, whose age and hometown were not available, was arrested for assault with a deadly weapon on a police officer, felony evading police, felony hit-and-run and weapons charges in connection to having a loaded gun. Police said he had multiple felony warrants for his arrest at the time of the chase.

David DeBolt covers breaking news. Contact him at 510-208-6453. Follow him at Twitter.com/daviddebolt.