Abortion-rights activists gathered outside the U.S. Supreme Court to protest against abortion laws passed across the country.

A federal judge in Mississippi on Friday temporarily blocked a state law that bans abortions once a fetal heartbeat is detected, which can be as early as six weeks into pregnancy.

Mississippi is one among a number of states that have moved to pass new restrictions on abortion this year, with some laws being pushed by abortion opponents who expressly hope to challenge the constitutionality of Roe v. Wade. Earlier this month, Alabama Gov. Kay Ivey signed into law a bill that bans doctors from performing abortions during any stage of pregnancy, punishable by up to 99 years in prison.

"Here we go again," U.S. District Judge Carlton Reeves wrote in his ruling Friday granting the request by the state's only abortion clinic, Jackson Women's Health Organization, to halt the law.

"The parties have been here before," Reeves wrote, referencing a prior Mississippi abortion law, which banned abortions after 15 weeks. Reeves blocked that bill in federal court last November, and, he wrote Friday, "the State responded by passing an even more restrictive bill."

The new law, Reeves wrote, "threatens immediate harm to women's rights, especially considering most women do not seek abortion services until after [six] weeks."

It "prevents a woman's free choice, which is central to personal dignity and autonomy," he continued, concluding that "this injury outweighs any interest the State might have in banning abortions after the detection of a fetal heartbeat."

Reeves heard arguments from the clinic and from state officials Tuesday. The law was scheduled to take effect July 1.

— CNBC's Tucker Higgins contributed to this report.