For indispensable reporting on the coronavirus crisis, the election, and more, subscribe to the Mother Jones Daily newsletter.

For decades, pro-choice activists have pushed to reform abortion access in one of the country’s most liberal states: New York. It still had on its books a law that criminalized abortions after 24 weeks, and the Legislature long refused to repeal it, stymying pro-choice lawmakers and activists. But on Tuesday, the 46th anniversary of Roe v. Wade, the New York State Senate finally passed a bill that repeals the draconian provision. The Reproductive Health Act was then signed into law late Tuesday night by Gov. Andrew Cuomo.

“New York once led the way on choice and women’s rights,” Senate Majority Leader Andrea Stewart-Cousins said in a statement after the vote. “Unfortunately for years barriers to women’s rights were put up, and our state has fallen behind. Today, we are tearing those barriers down.”

With abortion advocates energized and also worried about the future of Roe in the hands of an increasingly conservative Supreme Court, they argued that passing the RHA was both crucial and urgent.

Ironically, when the law legalizing the procedure was first passed in 1970, three years before Roe, it made New York a leader on access to abortion. Although it was considered extremely liberal at the time, it barred women from terminating their pregnancies after 24 weeks unless the woman’s life was in immediate danger, and it applied even if the fetus would not be able to live outside the womb. The procedure also had to be performed by a doctor, even if other kinds of health care providers—like nurse practitioners or physician assistants—were qualified and available. After 24 weeks, the law made self-induced abortions a misdemeanor crime, and made providing one a felony punishable by up to seven years in prison.

When Roe rang in a new era of reproductive rights, New York—along with the rest of the country—saw its practice change overnight, and in the years following, most blue states with more restrictive pre-Roe laws repealed them. But of the four states that legalized abortion pre-Roe, New York remained the only one that didn’t revise its law.

The ban forced New Yorkers who needed later-term abortions to travel out of state for the procedure, an obstacle that can be prohibitively expensive and time-intensive. Advocates also worried about how the old law criminalized termination. In 2014, for instance, a mother was jailed for ordering abortion pills online and helping her uninsured, teenage daughter self-induce an abortion. While most prosecutions related to the abortion law ultimately failed, “you cannot image the harm it does to someone to be dragged through the criminal justice system,” says Andrea Miller, the president of the National Institute for Reproductive Health. “To have your name released, to be called a criminal, and to have to defend yourself against those charges…even when they are dismissed, they do tremendous damage to women and their families.”

So nearly a decade ago, New York legislators, led by Democratic state Sen. Liz Kreuger, started to make a coordinated push to repeal the law. But thanks to the Independent Democratic Conference, a renegade group of Democrats that started consistently voting with Republicans in 2012, multiple attempts to further bills repealing the law failed; none ever made it to a vote.

“We saw both longstanding Republicans and members of the Independent Democratic Caucus lose their seats because voters wanted this bill passed.”

The landscape in New York and elsewhere started to shift following the election of Donald Trump. The threat of a more conservative Supreme Court has brought new energy to repealing archaic pre-Roe laws nationwide (just as it has given pro-lifers more hope for overturning Roe). Abortion advocates have also expressed particular alarm about laws criminalizing abortion, because Trump has threatened punishment for women who get abortions. To preempt a future marked by prosecutions, advocates are arguing that it’s necessary to quickly remove abortion from the criminal code.

As of January this year, the Guttmacher Institute, a think tank that studies reproductive rights, reported than nine states still had laws that ban abortion outright. In July, Massachusetts became the latest state to update its abortion laws, and pro-choice lawmakers in New Mexico and Rhode Island are hoping they’ll have the votes to repeal abortion bans this year.

The RHA then got a boost when the the IDC officially disbanded last April as members faced stiff primary opposition from the left. And in the lead-up to November, Democratic challengers like Julia Salazar and Zellnor Myrie campaigned on updating New York’s abortion laws, while Alessandra Biaggi, who challenged former IDC leader Jeff Klein, publicized how she had advocated passing the RHA while working at the Governor’s Counsel’s Office. All three won in November. “This was a critical issue in the midterm elections,” says Miller. “We saw both longstanding Republicans and members of the Independent Democratic Caucus lose their seats because voters wanted this bill passed.”

Ultimately, New York voters ousted six of eight former IDC members and put the Senate squarely back under Democratic control. Voting on the RHA quickly became a top priority for Democrats; Cuomo announced that he would “fight” to pass it within the first 30 days of the new legislative session.

The law protects New Yorkers’ right to access safe and legal abortion by taking it out of the penal code and into public health law, which means it cannot be prosecuted as a crime. It allows for abortion after 24 weeks in cases when the fetus is not viable and when the life or health of the woman is at risk. The law makes it legal to advertise, sell, and distribute contraceptives. And finally, it allows for qualified clinicians to administer abortions, not just doctors.

Beyond the RHA, New York legislators have also begun the process of passing several other progressive bills, including the recent Gender Expression Non-Discrimination Act, which prohibits discrimination based on gender identity or expression and adds transgender New Yorkers to those protected by the state’s Hate Crimes Law. At the same time, the Senate also passed legislation banning conversion therapy for children. The Comprehensive Contraceptive Coverage Act, previously stalled in the Senate, also passed Tuesday. The bill, reintroduced by state Sen. Salazar, broadens contraceptive coverage to include all forms of FDA-approved contraception and makes it easier to use insurance to cover emergency contraception.

“This is a historic moment for New York state to make the clear and bold statement,” Miller says. “We are hopeful that, by New York moving swiftly at the start of the year, it will add momentum to the efforts in other states.”