Olivia Spies, 12, crossed the courtroom gripping a lined piece of notebook paper and gathered her strength. Her father stood beside her, gently placing a hand on her back as she conveyed the pain their family endured when a stranger shot and wounded him in the line of duty last summer.

"What he did was horrific and devastating to me — and I will never forgive him," she told the judge, recounting the day Minneapolis police officer Jacob Spies took a bullet to the shoulder. "My dad is a hero and does many courageous things for people he doesn't even know."

Fredrick Davis Jr., 19, of Minneapolis, received a 12-year prison sentence and was convicted of attempted second-degree intentional murder during an emotional hearing Thursday, packed with uniformed police officers and command staff.

Davis pleaded guilty last month, admitting to firing a dozen rounds at Spies, who was driving an unmarked car with tinted windows, on Aug. 11 during a joint enforcement detail on the North Side. But Davis denied intentionally targeting a police officer, saying he pulled the trigger out of fear.

In his victim impact statement, Spies recounted how he'd been patrolling alone when he spotted a white SUV suspected of fleeing police following a robbery an hour earlier. He pursued the vehicle for about a mile and, just as he crested a hill, noticed the Chevy parked with its lights off.

Suddenly, Spies was overtaken by a volley of automatic gunfire — a sensation similar to having fireworks thrown at his car — and felt his right arm go numb.

He frantically radioed for help and sped away from the scene, planning to drive to the hospital. But responding officers intercepted their wounded colleague and police initiated a high-speed chase that continued for 26 blocks until the Chevy crashed into a parked car.

The bullet remains embedded in the back of Spies' shoulder, "a permanent souvenir" from that chaotic night.

"This was a calculated and planned ambush," said Spies, a seven-year MPD veteran who was awarded a Medal of Honor and the department's first Purple Heart. He lamented that Davis influenced a younger boy into participating, and that Davis had continued down a path of "felonious criminal activity" several years after Spies arrested him fleeing police in a stolen vehicle.

In December, a 17-year-old who shot at Spies but didn't strike him also pleaded guilty to attempted second-degree murder. As part of his plea deal, William Ward Jr. is receiving treatment at the Red Wing juvenile facility and will remain on extended probation until he's 21.

Senior Assistant County Attorney Patrick Lofton noted Davis was riding around with a Glock 19 equipped with a switch, making it fully automatic. It was mere luck that Spies survived the ordeal, he said, arguing that Davis' actions demonstrated an extreme risk to public safety.

"His behavior exhibits a worldview in which you shoot first and ask questions later," Lofton said, imploring Hennepin County Judge Hilary Caligiuri to impose a prison term of nearly 13 years, top of sentencing guidelines.

In response, Davis' public defender Elizabeth Karp urged the court to consider the context. Davis survived a gunshot wound to the chest a year before at the State Fair, resulting in lasting trauma. It made him afraid to leave the house, she said, and he obtained a firearm from a relative for protection.

Karp pushed back on the prosecution's depiction of Aug. 8, explaining that Davis saw an unknown vehicle following him that night and immediately "kicked into a fight or flight mode."

"Mr. Davis made a bad choice in a panicked state of mind," Karp said, acknowledging that it was not an excuse for what happened. "I don't think the evidence shows that he knew who was in that car."

She asked that the judge sentence Davis to 11 years, the lowest end of guidelines.

When given a chance to speak, Davis turned to his family in the front row and broke down, explaining that he "didn't know it was a police officer." Davis said he took responsibility for the crime, but denied forcing anyone else to participate or fleeing police that day.

"I'm not a bad person at all. ... I got family too," he said, sniffling as he pleaded with the judge for a lighter sentence. "Everybody should get a second chance at life. Everybody makes mistakes."

Caligiuri opted for a sentence near the top of the range, shaving six months off for his willingness to accept a plea deal. Davis will spend less than eight years in prison after accounting for time already served. In Minnesota, those sentenced to prison spend two-thirds of the sentence in custody and one-third under supervision.

Davis' family left the courtroom wiping their eyes, then walked through a flank of two dozen uniformed officers who were taking turns embracing Spies in the hallway.

Outside, Davis' mother defended the character of her son, a high school graduate and "a good person ... who has been through more than what people actually know."

"To know Fred is to love Fred," she said, declining to provide her full name.

In the lobby, surrounded by fellow officers and Police Chief Brian O'Hara, Spies hailed the conclusion of a long criminal justice process that has weighed on his family.

"I'm glad it's over," he said, thanking the broader law enforcement community for its outpouring of support. "It means a lot to me."