A man who raped a 6-year-old boy in a public library, while on probation for an attempted rape, was sentenced Thursday to life in prison.

Corey Deen Saunders pleaded guilty in February to the January 2008 rape of the boy at the New Bedford Public Library.

Prosecutors said Saunders lured the boy into a reading room at the library while the victim's mother worked on a computer only a short distance away. At the time of the attack, Saunders was a convicted sex offender who was on probation after serving four years in prison for the attempted rape of a 7-year-old boy.

The Bristol District Attorney's office sought a life sentence for Saunders in part because of the ages of the victims in both cases.

Saunders, 27, will be eligible for parole after 15 years. He was also sentenced to lifetime probation.

Saunders was released from prison in December 2006, despite objections from prosecutors and three psychologists who said he was too dangerous to be let out. He is a Level 3 sex offender, a designation given to those believed most likely to re-offend.

The case reignited debate over a civil commitment law that allows prosecutors to request that sexual offenders be locked up indefinitely after completing their prison terms.

Prosecutors sought to have Saunders committed after he served his term. But a judge rejected the request, citing Saunders' history of being sexually abused as a child and his lack of sexual crimes while in prison.