JUNEAU, Wis. (AP) — A Wisconsin prison inmate has pleaded guilty to a charge that he helped his cellmate hang himself from their bunk bed.

The move by 21-year-old Joshua Walters surprised his own defense lawyer. Walters decided Tuesday to accept a plea bargain offered by the prosecutor.

Walters has pleaded no contest to one count of assisting in the Jan. 10, 2009, suicide of 20-year-old Adam Peterson. They shared a cell at Dodge Correctional Institution in Waupun, Wis.

Dodge County District Attorney Bill Bedker will drop a penalty enhancement and recommend 30 months in prison when Walters is sentenced next week.

Prosecutors said he helped Peterson tie the noose to their bed using a sheet and then put his own head inside to test it out.