A man who tried to flee from police and accidentally discharged a firearm in the process was sentenced to 2½ years in prison on Thursday.

Tyler James Dahlstrom, 24, pleaded guilty to disorderly conduct and possession of a deadly weapon by a prohibited possessor in January.

In May 2013, Dahlstrom was the passenger in a car that Pima County sheriff’s deputies tried to pull over.

The driver tried to evade police and drove into a nearby parking lot at West River Road and North La Cholla Boulevard, where Dahlstrom ran away and jumped into another waiting car driven by a friend. Deputies then stopped that vehicle, and Dahlstrom again fled.

While running, Dahlstrom tripped and accidentally discharged a firearm.

Police arrested him, but not before firing several shots back at him.

“The defendant here is very lucky not to have been killed that night,” Deputy Pima County Attorney Rona Kreamer said.

Kreamer asked Pima County Superior Court Judge Richard Fields to impose an aggravated term, citing a failure to rehabilitate, danger to the community and because Dahlstrom was on release in a separate incident at the time of the crime.

Dahlstrom said he planned to use his time in prison to reform his life.

The prison term will be served concurrently with a separate conviction in which Dahlstrom was given 6½ years in prison on drug and vehicle-theft charges.

Contact reporter Patrick McNamara at 573-4241 or pmcnamara@azstarnet.com. On Twitter @pm929.