The abortion ban is the strictest in the US, and allows an exception only when the woman’s health is at serious risk.

The measure contains no exception for rape and incest. The bill now moves to the desk of Alabama’s Republican governor, Kay Ivey, who is anti-abortion, and is expected to sign it.

Civil rights groups have pledged to immediately challenge the ban in courts, which would mean abortion would remain legal in the state for now. But this sets up a fierce legal battle that anti-abortion campaigners hope will lead to the supreme court, and eventually result in overturning Roe v Wade, the landmark ruling that legalized abortion nationwide in 1973.

Democratic leaders reacted with outrage, and pledged to fight for abortion rights.

Elizabeth Warren, the Massachusetts senator and 2020 contender, tweeted: “This ban is dangerous and exceptionally cruel – and the bill’s authors want to use it to overturn Roe v Wade. I’ve lived in that America and let me tell you: we are not going back – not now, not ever. We will fight this. And we will win.”

The Alabama legislation, which passed by a vote of 25-6 on Tuesday night, makes it a class A felony for a doctor to perform an abortion in the state, punishable by 10 to 99 years in prison. Women would not face criminal penalties for getting an abortion.

Let me tell you: we are not going back – not now, not ever. We will fight this. And we will win.”

The bill is part of a trend across the US in which Republican-controlled states are attempting to put new restrictions on abortion, gambling that they will fare better in the courts following the confirmation of new federal judges and supreme court justices picked by the Trump administration.

States, including neighboring Georgia, have instituted bans on abortion after about six weeks into pregnancy, so early into gestation that many women may not yet know they are pregnant. These are also being challenged in the courts.

The Alabama vote came after a battle broke out over whether to allow legal abortions for women who become pregnant from rape or incest, an issue that divided Republicans who otherwise supported outlawing abortion.

Last week, chaos erupted on the floor of the Alabama state senate when Republican leaders stripped out the rape exception without a rollcall vote, leading the final vote to be postponed. It got a full vote on Tuesday, but ultimately failed.

On Tuesday, lawmakers approved the legislation after a debate that stretched more than four hours on Tuesday, where minority Democrats introduced a slew of amendments in an attempt to block it.

State senator Vivian Davis Figures told the bill’s proponents: “You don’t have to raise that child. You don’t have to carry that child. You don’t have to provide for that child. You don’t have to do anything for that child, but yet you want to make the decision for that woman.”

She introduced amendments that would require the state to expand Medicaid, force legislators who vote for the measure to pay the state’s legal bills, or make it a crime for men to get vasectomies. All failed.

Figures questioned the backers’ resistance to adding an exception for rape and incest. She said: “Do you know what it’s like to be raped? Why would you not want a woman to at least have that exception for such a horrific act?”

The legislation is poised for an immediate legal challenge and to be overturned at least by the lower courts.

The ACLU said it and Planned Parenthood “will file a lawsuit to stop this unconstitutional ban and protect every woman’s right to make her own choice about her healthcare, her body and her future. This bill will not take effect anytime in the near future, and abortion will remain a safe, legal medical procedure at all clinics in Alabama.”

Staci Fox, president of Planned Parenthood Southeast, which supports reproductive health and family planning, said: “To the Alabama politicians that voted for this bill, our message is this: you will forever live in infamy for this vote. And Planned Parenthood Southeast Advocates will make sure every woman knows who to hold accountable.”

The group created a separate phone line in response to an influx of calls from women confused about how the vote would affect their access to healthcare.

Fox said: “Imagine how many more women are too scared to call – who feel alone and abandoned by their state – to even reach out to make an appointment, who assume abortion is already illegal. Those are the women I am losing sleep over every night.”

Backers of the ban are hoping the fight will go all the way to the supreme court, which ruled in the 1973 Roe v Wade case that women must be allowed to get abortions up to the point where the fetus can survive outside the womb.

Republican state senator Clyde Chambliss said: “Human life has rights, and when someone takes those rights, that’s when we as government have to step in. When God creates that life, that miracle of life inside the woman’s womb, it’s not our place as humans to extinguish that life. That’s what I believe.”

The bill’s architects resisted the rape exception, saying they wanted a clean ban to present to the courts, and believed exceptions would violate the principle that an unborn child is a human life.

Opponents said the bill’s backers would squander public money defending a ban that will likely be struck down.

State senator Linda Coleman-Madison, a Democrat, said: “Alabama taxpayers are going to be footing the bill for this unconstitutional action.”

But the Republican Chambliss said the cost was worth it if the legislation is able to prevent abortions. “That’s pennies per baby,” he said.

Opponents predict the legislation will drive doctors to leave Alabama, which already has some of the highest rates of infant mortality and cervical cancer.

Outside the Alabama state house, protesters wore costumes from The Handmaid’s Tale and carried signs, one reading: “Alabama does not own me.”

Republicans, who have a super-majority in the chamber, carried the vote by a large margin, but the debate was dominated by Democrats objecting to the legislation, while few supporters spoke out on the floor. All six who voted against the bill were Democrats.

The Senate minority leader, Democrat Bobby Singleton, launched a filibuster in an effort to delay the vote, until Republicans approved a motion to end debate.

Singleton said: “You just raped the state of Alabama. The state of Alabama ought to be ashamed of itself.” He said the message this move gave to women is: “We’re just going to continue to kick ’em in the gut.”

As the vote was called, he concluded: “I would just like to say to all the women of the state of Alabama: I’m sorry.”