A federal judge on Thursday blocked an Indiana law that would have banned abortions based solely on a fetus’s disability or genetic anomaly, suggesting that it was an illegal limit on a woman’s long-established constitutional right.

Judge Tanya Walton Pratt, of Federal District Court for Southern Indiana, also held up a state ban on abortions motivated solely by a fetus’s race or sex. In the preliminary injunction, Judge Pratt said limiting the reasons for an abortion was “inconsistent with the notion of a right rooted in privacy concerns and a liberty right to make independent decisions.”

While Judge Pratt’s injunction stops the law from taking immediate effect, and though she said the state would be unlikely to prevail at trial, the state can still defend the legislation. In a statement, the Indiana attorney general’s office said state lawyers would consider how to proceed and whether to appeal the injunction.

Indiana would have been the first state to have a blanket ban on abortions based solely on race, sex or suspected disabilities, including evidence of Down syndrome. A handful of states have bans on abortion based on sex, one state has a ban based on race, and two have bans based on genetic anomalies, according to the Guttmacher Institute, a nonprofit abortion rights group that tracks state laws.