Alabama's governor signed into law legislation that requires some sexual offenders to be chemically castrated before being released on parole.

Gov. Kay Ivey, a Republican, signed the bill Monday. It applies to sex offenders eligible for parole after being convicted of crimes involving children under 13.

Chemical castration involves taking medication to reduce testosterone, hormones and other chemicals that drive libido. The parolees are required to start the treatment a month before they leave prison and continue treatment until the court determines it is no longer necessary.

Republican state Rep. Steve Hurst introduced the bill, which the state Legislature passed last week. The representative’s previous bills on the subject, which would have forced sex offenders to pay for their own surgical castration, failed to make it out of committee.

June 5:Alabama bill would require chemical castration for parolees convicted of sex crimes involving children

This law differs in that parolees are required to pay for the treatment, but they cannot be denied parole if they are not able to pay.

Hurst defended the bill against those who called it inhumane, telling WIAT-TV in Birmingham last week that sex offenders "have marked this child for life, and the punishment should fit the crime."

"I asked them what's more inhumane than when you take a little infant child, and you sexually molest that infant child when the child cannot defend themselves or get away, and they have to go through all the things they have to go through," he said. "If you want to talk about inhumane – that's inhumane."

The Alabama American Civil Liberties Union said ordering chemical castration could violate the Constitution’s Eighth Amendment, which forbids cruel and unusual punishment.

Seven other states and territories – California, Florida, Guam, Iowa, Louisiana, Montana and Wisconsin – have authorized chemical castration. Offenders may be sentenced to chemical castration in all cases involving serious sex offenses in Iowa, California and Florida.

Follow Elinor Aspegren on Twitter: @elinoraspegren.

Contributing: Ryan Miller, USA TODAY; The Associated Press