URBANA — A Rantoul man who threw a gun out a window as police were about to search an apartment where he was has been sentenced to five years in prison.

Zamarlon Parker, 29, who last lived in the 300 block of Penfield Street, pleaded guilty Wednesday before Judge Roger Webber to unlawful use of weapons by a felon.

He admitted that on Dec. 12, when University of Illinois police went to conduct a court-authorized search of an apartment he was in on Dale Drive in Champaign, he tossed a 9 mm handgun from the window of a second-story bedroom.

Assistant State’s Attorney Victoria Dedman said officers there to investigate a credit-card fraud heard something hit a tree as they approached and found a gun.

With multiple felony convictions, including two for drug-related crimes, Parker is not allowed to possess a weapon.

A more serious charge alleging he was an armed habitual criminal was dismissed in return for his guilty plea. The state’s attorney’s office also agreed to dismiss two other felony cases in which he was charged with domestic battery, criminal damage to property and violating bond, and a misdemeanor case in which he was accused of resisting a peace officer.

He was given credit on his sentence for 78 days already served in the county jail.