CROWN POINT — A Gary man was sentenced to 12 years in prison on allegations he shot at police in 2014 and was dealing cocaine in 2017 when police searched his Gary apartment, records show.

Dwayne Allen Gunn, 35, pleaded guilty in December to two counts of attempted battery in the 2014 shooting and admitted in January to one count of dealing in cocaine. Prosecutors dropped several counts in exchange for his plea.

Lake Criminal Court Judge Diane Boswell sentenced Gunn on Tuesday to six years on each count in the 2014 case, to be served concurrently. Gunn also was sentenced to six years in the drug case, to be served consecutive to the attempted battery sentence for a total 12 years. *

Gunn was charged in February 2014 on allegations he fired a gun at members of the Gary Police Department SWAT team when officers served a search warrant on the 5000 block of Virginia Street.

No officers were wounded, but Gunn was shot when police returned fire.

Officers executed the warrant at the residence after a confidential informant purchased cocaine and heroin there in January 2014.

On Feb. 28, 2017, a Lake County sheriff's deputy trying to locate another person of interest in a civil matter walked past Gunn's apartment in the 5200 block of Broadway and noticed a "strong odor of unburnt marijuana," court records say.

Gunn initially answered the door, but then slammed it. The deputy forced his way inside and arrested Gunn. Police later executed a search warrant and found two weapons, about 170 grams of cocaine, 112 grams of marijuana, $22,445 in cash and other items, records say.

Boswell also ordered the destruction of two handguns and an AR-15 rifle seized in Gunn's various cases, Deputy Prosecutor Judith Massa said.

* Editor's note: This story has been updated to correct that Gunn was sentenced to six years in two cases, to be served consecutively for a total of 12 years in prison. The amount of marijuana seized Feb. 28, 2017, from Gunn's apartment was 112 grams. The Times regrets the errors.

Recent arrests booked into Lake County Jail