The fatal shooting of a man who brutally attacked a Salt Lake City cop with his own police baton has been ruled justified by Salt Lake County District Attorney. Watch the graphic body cam footage of the incident above.

According to NBC affiliate KSL, it all began when Officer Gregory Lovell responded to a call on Sept. 28 about a man trespassing in a salon and groping a woman. The video starts with Lovell approaching the salon. He then sees the suspect—39-year-old Michael Bruce Peterson—walking across the parking lot. Lovell repeatedly orders Peterson to stop walking, but Peterson ignores him. As Lovell is following from a distance, he radios for backup, saying, “He’s not going to stop for me.”

The video shows Peterson getting into an unlocked Jeep that isn’t his. That’s when Lovell says “Don’t!” and orders him out of the vehicle while Peterson ignores him and curses at him repeatedly. At that point, Lovell uses a Taser on Peterson through the open window of the car. That’s when Peterson gets out of the Jeep and lunges at Lovell.

It’s hard to follow what’s happening from Lovell’s body camera at that point, but surveillance footage from a nearby store shows Peterson attacking him across the store parking lot. Peterson then picks up Lovell’s standard-issue baton—which was dropped during the scuffle—and starts to repeatedly beat him with it.

While this is going on, Salt Lake Police Lt. Andrew Oblad arrives on the scene. A bystander in a nearby truck used his cell phone to film what happened next.

“Oh, you want some of this?” Peterson asks as he approaches Oblad with the baton raised like a baseball bat. Oblad opens fire, shooting Peterson 10 times. Oblad later stated that when the initial shots didn’t stop Peterson, he surmised that he may be wearing body armor, so he kept firing. Peterson was pronounced dead at the scene.

Lovell suffered a broken ankle and nose, as well as multiple lacerations as a result of the attack. He’s still recuperating from his wounds. Oblad also sustained lacerations and contusions, but he doesn’t know how he was injured. As the Salt Lake Tribune points out, Peterson was close enough to Oblad to hit him with the baton, but the body cam footage doesn’t show that, and no witnesses saw it happen.

As it happens, Oblad was finishing up his final shift with the Salt Lake City Police Department before retirement when he responded to Lovell’s call for backup.

“The men and women of the Salt Lake Police Department are trained … to have the judgment and the ability to operate in these very violent and very fast-moving situations,” Salt Lake Police Chief Mike Brown said. “It doesn’t matter if it’s your first day on the job, it doesn’t matter if it’s your last day on the job. It’s important that we instill that kind of training and those kinds of skills into our officers.”

Salt Lake County District Attorney Sim Gill has ruled the shooting to be justified.

“The violence that’s exacted against officer Lovell and the threat that is present to Lt. Oblad, that is ever-present and escalating, they had no choice but to use the force that they did,” Gill said.

Peterson has an extensive rap sheet that goes back more than 20 years. He served multiple stints in Utah State Prison, including a sentence for attempted murder and tampering with a witness. When the shooting occurred, a warrant was out for Peterson’s arrest after he fled from a halfway house after being let out of prison on parole.