Prison records show a registered sex offender who is accused of attempted rape in Foley had a violent past, even while behind bars for nearly 20 years.