Police say Steven Michael Grogg walked into the North Richland Hills police station bleeding from the head in October after someone who knew the child assaulted him.
Tarrant County Assistant District Attorney Dale Smith said during Monday's sentencing that "it's very rare to see a case like this."
Authorities say the 60-year-old confessed. Court documents indicate that Grogg committed sexual acts on the girl several times last year when he and his wife babysat.
Weeks later, someone confronted Grogg about it and beat him up.
The Fort Worth Star-Telegram reports that Grogg pleaded guilty to aggravated sexual assault of a child on Friday.