(Reuters) - A divided federal appeals court on Friday said Ohio cannot enforce a 2017 law banning abortions when medical tests show that a fetus has Down syndrome.

Upholding a preliminary injunction, the 6th U.S. Circuit Court of Appeals in Cincinnati said the law was invalid under Supreme Court precedents because it had the purpose and effect of preventing some women from obtaining pre-viability abortions.

Circuit Judge Bernice Bouie Donald wrote in a 2-1 decision that the injunction also served the public interest by ensuring “access to constitutionally protected health care services.”

The law known as House Bill 214 subjected doctors to as much as 18 months in prison for performing abortions when they knew a pregnant woman based her decision to abort at least in part on a prenatal diagnosis of Down syndrome in the fetus, or other reason to believe that condition was present.

John Kasich, then Ohio’s Republican governor, signed the law in December 2017, following passage by the Republican-controlled legislature.

Ohio will ask the entire 6th Circuit to review the case, a spokesman for state Republican Attorney General Dave Yost said.

A large majority of the court’s members was appointed by Republican presidents, but Friday’s majority consisted of Democratic appointees.

U.S. District Judge Timothy Black in Cincinnati had issued the injunction in March 2018, in a lawsuit by Planned Parenthood and other abortion providers.

The law “undermines the relationship between patients and their doctors” and the appeals court was “absolutely correct” to uphold the injunction, said Jessie Hill, an American Civil Liberties Union of Ohio lawyer representing the providers.

In July, a federal judge blocked Ohio from enforcing a fetal “heartbeat” law that critics said could ban abortions as early as six weeks into pregnancy.

Many other states have also sought recently to ban pre-viability abortions.

Anti-abortion advocates hope the Supreme Court’s five-justice conservative majority might use one of the many lawsuits challenging such restrictions to narrow or overturn Roe v. Wade, the 1973 decision declaring a constitutional right to abortion.

Down syndrome is a genetic disorder where a person is born with an extra chromosome. Symptoms include cognitive impairment, slower physical growth, a flat face, a small head, a short neck and poor muscle tone.

Circuit Judge Alice Batchelder dissented on Friday, quoting from a May opinion where Supreme Court Justice Clarence Thomas said states have a “compelling interest in preventing abortion from becoming a tool of modern-day eugenics.”

Batchelder was appointed by President George H.W. Bush, Donald by President Barack Obama, and Chief Judge Guy Cole, who joined Donald’s opinion, by President Bill Clinton.