MONTGOMERY, Ala. (AP) – A federal judge has blocked part of an Alabama law that makes it a felony to give gender-affirming puberty blockers and hormones to transgender minors.

U.S. District Judge Liles Burke issued a preliminary injunction on Friday to stop the state from enforcing the medication ban while a court challenge goes forward. The law took effect on May 8.

Parents with transgender children and the U.S. Department of Justice have challenged the legislation as unconstitutional.

The judge left in place other parts of the law that banned gender-affirming surgeries and requires school officials to tell parents if a minor discloses that they are transgender.

The legislation is the first in the country to levy criminal penalties against doctors who provide the medications.