Question about the Movie "Under Suspicion"?

I just don’t get it. Why did Gene Hackman confess to all those crimes(raping and killing young teenage girls)when he didn’t do it?