krblokhin/iStock(MONTGOMERY, Ala.) -- Alabama lawmakers have passed legislation that would require convicted child sex offenders to undergo “chemical castration treatment” before they are released from prison.

The bill, HB 379, which passed unanimously in the state Senate on Tuesday, 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. The offender will also be required to pay for the treatment unless they cannot afford it.

The bill still needs to be signed by Alabama Gov. Kay Ivey to become law.

Alabama is not the only state to consider 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.

Texas also has a chemical castration law. However, the treatment in that state cannot be a condition for parole, and the inmate must request the procedure. Michigan used to have a law mandating chemical castration as a parole condition, but an appeals court in 1984 ruled that this was unlawful.

State representative Steve Hurst first introduced the bill in the Alabama state House.

The chemical castration treatment is planned to start a month before the 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.

Alabama state senator Linda Coleman-Madison, a Democrat, voted in favor of HB 379, but told a ABC Alabama affiliate WBMA-TV that she questions how well it will be enforced.

"I didn't think that it would get passed really and I'm wondering whether the governor is really going to sign it," Coleman-Madison said.

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 that 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.

The American Civil Liberties Union of Alabama did not immediately return ABC News' request for comment about the Alabama bill.

Copyright © 2019, ABC Radio. All rights reserved.