BISMARCK, N.D. — A federal judge on Wednesday overturned a North Dakota law that bans abortions when a fetal heartbeat can be detected, which can be as early as six weeks into pregnancy and before many women know they're pregnant.

U.S. District Judge Daniel Hovland said the law is "invalid and unconstitutional" and that it "cannot withstand a constitutional challenge." The state attorney general said he was looking at whether to appeal the decision by the Bismarck-based judge.

North Dakota is among several conservative states that have passed new abortion restrictions in recent years, but abortion rights supporters called North Dakota's fetal heartbeat law the most restrictive in the country. A fetal heartbeat law passed in Arkansas would ban abortions at 12 weeks into pregnancy, but it was overturned by another federal judge. The state's attorney general has said he will appeal.

North Dakota's heartbeat measure was among four anti-abortion bills that Republican Gov. Jack Dalrymple signed into law last year with overwhelming support from the state's Republican-led Legislature. Backed by the New York-based Center for Reproductive Rights, the state's only abortion clinic, the Red River Clinic in Fargo, filed a lawsuit against the heartbeat law last July.

"The United States Supreme Court has spoken and has unequivocally said no state may deprive a woman of the choice to terminate her pregnancy at a point prior to viability," Hovland wrote in his ruling. "The controversy over a woman's right to choose to have an abortion will never end. The issue is undoubtedly one of the most divisive of social issues. The United States Supreme Court will eventually weigh in on this emotionally-fraught issue but, until that occurs, this Court is obligated to uphold existing Supreme Court precedent."

Nancy Northrup, president and CEO of the Center for Reproductive Rights praised Hovland's ruling.

"The court was correct to call this law exactly what it is: a blatant violation of the constitutional guarantees afforded to all women," Northrup said in a statement. "But women should not be forced to go to court, year after year in state after state, to protect their constitutional rights. We hope today's decision, along with the long line of decisions striking down these attempts to choke off access to safe and legal abortion services in the U.S., sends a strong message to politicians across the country that our rights cannot be legislated away."

Supporters of the measure have said the measure is a challenge to the U.S. Supreme Court's 1973 ruling that legalized abortion up until a fetus is considered viable, usually at 22 to 24 weeks. Opponents say it's an attempt to shutter the Red River Clinic.

The director of the Fargo clinic, Tammi Kromenaker, said Hovland's ruling was expected.

"It's not a surprise that the judge ruled this way but it's definitely a relief," she said. "We told the Legislature and we urged the governor to veto the bill, telling him this was not going to withstand constitutional muster."

Last year, lawmakers in oil-rich North Dakota allocated $400,000 that was requested by Attorney General Wayne Stenehjem to defend against any lawsuits arising from the state's new abortion laws.

Stenehjem told The Associated Press on Wednesday that he needed to read Hovland's ruling and talk to the governor and others before deciding what the state will do next.

"There are those who believed that this was a challenge that could go to the Supreme Court," Stenehjem said. "Whether or not that's likely is something we need to confer about."

Stenehjem said the ruling wasn't a surprise, saying Hovland signaled his intentions by halting the law while he considered the lawsuit. The law was set to take effect Aug. 1.

"He fairly telegraphed it when he issued his preliminary injunction," Stenehjem said.