A federal judge in Missouri blocked the state on Tuesday from enforcing a ban on abortions after the eighth week of pregnancy, enacted by Republican legislators this year as part of a national campaign to restrict abortion and perhaps prompt the United States Supreme Court to revisit Roe v. Wade.

Senior Judge Howard F. Sachs of the Federal District Court in Kansas City, Mo., issued his ruling a day before the law was scheduled to take effect. The judge criticized lawmakers’ “hostility” to Supreme Court precedent on abortion, and said the eight-week ban stood little chance of prevailing. He also blocked other portions of the law that variously sought to ban abortions after 14, 18 or 20 weeks of pregnancy, all before a fetus becomes viable outside the womb.

“While federal courts should generally be very cautious before delaying the effect of state laws, the sense of caution may be mitigated when the legislation seems designed, as here, as a protest against Supreme Court decisions,” said Judge Sachs, who was appointed by President Jimmy Carter.

Judge Sachs allowed some provisions of the law to take effect, including those banning abortions motivated solely by the sex or race of the fetus or by a diagnosis of Down syndrome.