BELCHERTOWN, Mass. (AP) — A 23-year-old man has been sentenced to two years in prison for the armed robbery of a University of Massachusetts-Amherst student that triggered a campus lockdown in February.

Shawn Wyatt, of Framingham, pleaded guilty Friday in Eastern Hampshire District Court to larceny and assault and battery with a dangerous weapon.

Wyatt admitted that he and co-defendant William McKeown tried to pass off shredded vegetables as marijuana in a drug deal on campus on February 18. A fight with the buyer -- a student -- ensued, and Wyatt struck the victim with his fists and a BB gun. The two made off with $120.

Wyatt has been in custody since turning himself in March 15. McKeown has been out on bail since his arrest. His next court date is June 21.