The Alabama law, which would have forbidden abortions in almost every instance, was scheduled to take effect on Nov. 15.

Credit...Michael Spooneybarger/Reuters

A federal judge blocked Alabama’s near-total ban on abortions on Tuesday, stopping the legislation from taking effect next month.

The ruling, an early step in a legal confrontation that critics of abortion orchestrated to try to reach the United States Supreme Court, ensured that abortion services would remain available in the state, at least for now.

The Alabama law would have made it a felony for doctors to provide abortions in almost all circumstances, and it threatened them with up to 99 years in prison. The law did not include any exceptions for abortions in cases of rape or incest, allowing the procedure only when a woman’s health was at “serious” risk.

The preliminary injunction, which was issued by Judge Myron H. Thompson of the United States District Court in Middle Alabama, will remain in effect until the “court resolves the case in full.”