BRIDGEPORT, Conn. (CBSNewYork/AP) — A New Haven man charged with sexually molesting a 13-year-old boy in the bathroom of a Bridgeport church has pleaded guilty just before his trial was about to start.

Gary Robinson, 32, agreed to plead guilty Tuesday to risk of injury to a minor, the Connecticut Post reported.

READ MORE: Customs Officials Say 3 Pounds Of Cocaine Found On - And In - Person Returning From Dominican Republic

Robinson faces up to four years in prison at sentencing scheduled for July 1, but the judge said Robinson’s lawyer could ask for a shorter term.

Prosecutors say the boy’s parents are not happy with the plea but have agreed to go along with it to spare their son from testifying.

READ MORE: Police: Groper Attacking Women In Rutherford, Including Mom Pushing A Stroller

Tavone Brown, 36, of Bridgeport and Ryan Covington, 26, of Stratford, are also facing charges after being accused of sending explicit text messages and photographs to the child, the Post reported.

The assault occurred at the Prayer Tabernacle Church of Love in 2012.

MORE NEWS: Kimberly Druhan, Baltimore Woman Last Seen In Brooklyn, Found After Search

(TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)