A federal judge on Friday temporarily blocked a Kentucky law that prohibits abortion after a fetal heartbeat is detected, which typically happens around six weeks into pregnancy, before many women know they are pregnant.

The measure, which was signed into law on Friday by the state’s Republican governor, Matt Bevin, and was set to take effect immediately, was poised to become one of the strictest anti-abortion laws in the country.

But late on Friday, the judge, David J. Hale of the Western District of Kentucky, ruled the law was potentially unconstitutional. He halted enforcement for at least 14 days to “prevent irreparable harm” until he could hold a hearing.

The ruling came amid a yearslong effort to curb abortions in Kentucky, which has one remaining abortion clinic. Several other states are considering similar measures, known as heartbeat bills, as states move to restrict — or shore up access to — abortion in anticipation of a more conservative Supreme Court possibly ruling on the issue.