A convicted sex offender pleaded guilty Monday to raping a 6-year-old boy at a Massachusetts public library last year while he was on probation.

Corey Deen Saunders, 27, entered the plea Monday to child rape and related charges. He was arrested Jan. 30, 2008, after luring the boy to the magazine stacks in the New Bedford library while the child's mother worked on a computer just a few feet away.

At a court hearing last year, prosecutors played a videotaped interview in which the boy told a child welfare official the assault was like being attacked by a "T-rex and an alligator."

At the time, Saunders was on probation after serving four years in prison for the attempted rape of a 7-year-old boy.

Saunders had been released in 2006 despite objections from prosecutors, who are allowed under state law to ask that sex offenders be locked up indefinitely after completing their prison terms. Three psychologists supported the commitment request, but the judge granted him probation, citing his lack of sexual crimes while in prison.

In April, a judge who heard the 6-year-old boy's videotaped account revoked Saunders' probation and sentenced him to the maximum five years in the earlier case. The judge ruled Saunders had violated an order not to have unsupervised contact with minors.

On Monday, Bristol County District Attorney Sam Sutter sought a life sentence because of the victim's age and Saunders' earlier conviction.

Saunders' defense attorney, Alan Zwirblis, recommended a shorter sentence, including probation. The judge did not immediately set a sentencing date but asked both sides to submit written arguments by Feb. 17.