A Salt Lake City police officer who fatally shot a man after a violent confrontation at a Maverik station in September was legally justified in using deadly force, Salt Lake County District Attorney Sim Gill said Wednesday.

Gill also on Wednesday released body camera footage showing the man, 39-year-old Michael Bruce Peterson, acting erratically and assaulting police officer Gregory Lovell with his own baton just before Lt. Andrew Oblad shot and killed Peterson.

Both police officers were injured in the Sept. 28 altercation, which began with reports of Peterson allegedly trespassing and harassing employees at a building that includes a massage school before being shot in a Maverik parking lot at 300 South and 500 East, according to Salt Lake City police.

“These are tragic situations,” Salt Lake City Police Chief Mike Brown said at a news conference called by Gill. “No officer wants to be engaged in a gun battle like that.”

Gill showed officer Lovell’s body camera footage, a video shot from a bystander’s cell phone, and security camera video from the Maverik where the shooting happened. Oblad’s body camera footage was not available because the officer, believing he was done for the day, had just begun charging it, according to Gill.

“Officer Lovell did everything in his power to de-escalate the situation,” Gill said. “You can see how it progressed up and how he went in a series of graduated use of force and when those failed, how that escalated up.”

(Trent Nelson | The Salt Lake Tribune) Michael Bruce Peterson appears on a police body-cam video shortly before his death. Salt Lake County District Attorney Sim Gill announced his finding that the Sept. 28 incident in which 39-year-old Michael Bruce Peterson was shot and killed by Salt Lake City police officers was a justified use of force, at a news conference in Salt Lake City, Wednesday October 25, 2017.

The released video shows Lovell using a Taser and a baton before Oblad fired shots.

Lovell had responded to the reports of a man trespassing at a building that houses a massage school and beauty salons at 363 S. 500 East, where he had allegedly grabbed a woman’s buttocks. The officer followed Peterson, a recently released prison parolee, down 300 South toward the Maverik parking lot, telling him to stop and talk.

Peterson got into the driver’s seat of a stranger’s jeep in the Maverik parking lot. After Peterson refused to get out of the jeep, Lovell used the Taser on him. Peterson shouted profanities, jumped out of the jeep and assaulted the officer. Lovell tried the Taser again, which reportedly didn’t phase Peterson.

Video shows Peterson punching and chasing an officer, who backed away, fell and reached for his baton. The baton rolled away from the officer, and then Peterson grabbed it and beat the officer.

When a man who had been standing at a gas pump saw the officer use his Taser, he jumped into his truck, locked his doors and started recording the assault.

“Somehow, the man had the cop‘s baton and was running to attack the cop,” the witness reported to the police.

(Trent Nelson | The Salt Lake Tribune) Michael Bruce Peterson appears on a video charging an officer with a baton before he was shot by police. Salt Lake County District Attorney Sim Gill announced his finding that the Sept. 28 incident in which 39-year-old Michael Bruce Peterson was shot and killed by Salt Lake City police officers was a justified use of force, at a news conference in Salt Lake City, Wednesday October 25, 2017.

Oblad reported that he responded to Lovell’s call for backup and arrived to see blood on Lovell’s face. He tried to draw Peterson away from the officer by ordering him to stop. Video shows Peterson taking a batter’s stance with the baton as he ran at Oblad.

Oblad backed away and fired his weapon. Peterson didn’t stop, despite the bullets hitting him.

Oblad — who later said he feared Peterson might be wearing body armor because he kept coming — continued firing until Peterson fell.

He fired 10 shots total, all of which struck Peterson, according to a written report released Wednesday by Gill in conjunction with the body camera footage.

Peterson died at the scene, sprawled on his back and wearing neon green athletic shoes.

“My ankle’s broken, man,” Lovell is heard saying on the video at that point. He also had a broken nose and lacerations, Gill said.

Oblad suffered contusions and lacerations, but doesn’t recall how he was injured, according to Gill’s report. Video footage shows Peterson was close enough to Oblad to hit him with the baton, but the video does not show that, and no witness saw that happen, the report says.

The injured officers were taken to hospital and released later that evening, Brown said.

The shooting happened on Oblad’s last day. He’d been planning to retire, and that afternoon had been his last shift. He was put on administrative leave after the shooting. Oblad had been on the force for 20 years, Lovell for eight, according to Brown.

Lovell was put on medical leave. He has not yet returned to the force, according to Brown, who added the police officer is still on crutches.

Brown said the situation began about 3:50 p.m. when Peterson entered the massage school building.

After allegedly grabbing one woman’s buttocks, Peterson walked into another studio, lay down on a table and demanded a massage, according Gill’s report.

Peterson tried to take an employee’s phone away — saying he wanted to talk to police — and shouted profanities as left the studio.

Lovell met him in the massage school building’s parking lot. Peterson reportedly said, “Let‘s go take a ride” and tried to get into the squad car, according to the report. Lovell, suspicious that Peterson might be on drugs, asked for backup officers to “step it up.”

Peterson started walking toward the Maverik, where the confrontation escalated.

Peterson had grown up in Orem and Provo, according to his family. Since 2007, he’d been in and out of prison due to several parole violations, according to prison officials.

Most recently, he was at the prison for a parole violation from March to August of this year, according to prison officials. In August, he was paroled to the Fortitude Treatment Center in Salt Lake City.

But according to his grandmother, who spoke to The Tribune in September, her grandson — a father of two — was caught using drugs and was sent back to prison for a month. He was released from prison to a halfway house on Sept. 26, two days before the shooting.

The state medical examiner’s office hasn’t yet released a toxicology report, Gill said.

Peterson was the third person shot by Salt Lake City officers this year.

On Aug. 13, Salt Lake City police shot and killed 50-year-old Patrick Harmon after he allegedly pulled a weapon on officers who were trying to arrest him on an outstanding felony warrant. The shooting occurred about 10:20 p.m. at 1002 S. State Street.

Gill has ruled that the officer was legally justified in using deadly force.

On May 30, Roman Jade Carrillo, 18, of Bountiful, was fatally wounded during an exchange of gunfire with two Salt Lake City police officers — an episode that followed an unrelated shooting in downtown Salt Lake City and a high-speed car chase that ended in Tooele County.

Tooele County Attorney Scott Broadhead has ruled that the two officers were legally justified in using deadly force.

Correction: Oct. 27, 1:40 p.m. >> An earlier version of this story misstated where one of the 911 calls came from. Calls came from the building occupied by Healing Mountain Massage School, not from the school itself.