A man who pleaded guilty to shooting at Anchorage police officers investigating a string of burglaries in fall 2012 was sentenced to 22 years in prison Friday in Anchorage Superior Court.

Deputy district attorney Clint Campion said Jason Barnum, 39, pleaded guilty to attempted murder, a consolidated first-degree burglary charge and third-degree weapons misconduct. The attempted-murder charge carried the most severe penalty, 20 years.

Barnum was charged with 33 criminal counts after shooting an Anchorage police officer in September 2012 at a hotel near Merrill Field airport. He later admitted to stealing cars and burglarizing homes to feed a heroin addiction.

Police were investigating those break-ins when Barnum opened fire from a bathroom at the Merrill Field Inn, according to an Anchorage Daily News story at that time. Two officers shot back, striking Barnum in the right arm.

An officer was injured in the gunfire but had been expected to return to work days later.

Barnum has a nickname, "Eyeball," from a tattoo that darkens the white of his right eye.

A District Court judge in 2012 set Barnum's bail at $500,000, and he has remained jailed since the shooting, which was followed by a two-hour standoff. His criminal history includes convictions for burglary, forgery and resisting arrest.

Campion said he is satisfied with the case's resolution. He said that if Barnum had been convicted after a trial, he might have gotten a more significant sentence.

"But there's always risk with going to trial," the prosecutor said. "There was a lot of litigation in the case, some of which went our way and some that was still undecided."

Barnum spoke before the court and acknowledged lifestyle choices that led to his long sentence, according to Campion. He apologized for hurting people, Campion said.

"I thought he provided some measure of insight into his own criminality and decision-making process with some recognition of the challenges he's created in his own life," Campion said.