Alabama Gov. Kay Ivey signed into law a controversial bill that requires chemical castration for convicted child sex offenders before they are released from prison.

The bill, HB 379, requires convicted offenders who abused a child under the age of 13 to take drugs -- such as medroxyprogesterone acetate treatment, that block the production of testosterone as well as other naturally occurring hormones and chemicals in the body that drive libido -- as a condition for parole. Offenders will also be required to pay for the treatment unless they cannot afford it.

Alabama is not the only state to require chemical castration for sex offenders. California passed a chemical castration bill in the 1990s for repeat child sex offenders, and a similar law exists in other states including Florida, Louisiana, Montana and Oregon.

Michigan used to have a law mandating chemical castration as a parole condition, but an appeals court in 1984 ruled it unlawful.

Texas, meanwhile, has a law that stipulates an orchiectomy cannot be a condition for parole, and the inmate must request the procedure for it to be performed.

Under the Alabama law, chemical castration treatment is planned to start a month before an inmate is set to be released from prison, and will continue until the court decides it is no longer necessary, according to the bill.

Once released, if the parolee decides to stop receiving the treatment, they will be found in violation of their parole and immediately sent back to prison. Some studies have found that chemical castration of sexual offenders is effective in reducing recidivism in certain cases.

Critics of mandated chemical castration, such as the American Civil Liberties Union (ACLU) say it is a violation of the Eighth Amendment’s ban of "cruel and unusual punishment".

In 1997, the ACLU openly opposed the passing both California and Florida's castration laws.