SALEM – Karl Lamont Hackney, a Level 3 sex offender from Lynn who escaped from Salem District Court through a back door in December, may serve up to 10 years in prison after pleading guilty Monday.Hackney also fired a gun in his apartment last June on North Common Street and was caught with drugs after leading police on a chase.Hackney, 46, formerly of 69 North Common St., #21, Lynn, pleaded guilty Monday afternoon in Salem Superior Court to all the indictments lodged against him in a plea deal worked out between Assistant District Attorney Kristen R. Buxton and defense lawyer Christopher Norris.Hackney pleaded guilty to charges of assault by means of a dangerous weapon, discharging a loaded firearm within 500 feet of a dwelling, possession of heroin with the intent to distribute, possession of cocaine with the intent to distribute, carrying a firearm without a license, subsequent offense, and escaping from a penal institute before Judge Garry V. Inge.He was sentenced to serve not less than nine and a half years and not more than 10 years in state prison for the escape and drug charges.He also was handed a four- to five-year prison term for the assault charge and another five to seven on the subsequent gun charge.Inge agreed to follow the joint recommendation of Buxton and Norris.Buxton stated she was prepared to show at trial that on the night of June 2, 2010, Hackney got into an argument with his 48-year-old girlfriend, assaulted her and then shot a bullet from a .380 semi-automatic handgun directly above his unit into the ceiling of an unoccupied apartment on the third floor of the North Common Street rooming house.Hackney served a 15-year prison sentence beginning in 1985 out of Connecticut for aggravated rape of a woman and child rape involving the sexual misconduct with a 15-year-old girl.