Updated September 6, 2023 at 9:45 PM ET

MEXICO CITY (AP) — Mexico's Supreme Court threw out all federal criminal penalties for abortion Wednesday, ruling that national laws prohibiting the procedure are unconstitutional and violate women's rights in a sweeping decision that extended Latin American's trend of widening abortion access.

The high court ordered that abortion be removed from the federal penal code. The ruling will require the federal public health service and all federal health institutions to offer abortion to anyone who requests it.

"No woman or pregnant person, nor any health worker, will be able to be punished for abortion," the Information Group for Chosen Reproduction, known by its Spanish initials GIRE, said in a statement.

Some 20 Mexican states, however, still criminalize abortion. While judges in those states will have to abide by the court's decision, further legal work will be required to remove all penalties.

Celebration of the ruling soon spilled out onto social media.

"Today is a day of victory and justice for Mexican women!" Mexico's National Institute for Women wrote in a message on the social media platform X, formerly known as Twitter. The government organization called the decision a "big step" toward gender equality.

Sen. Olga Sánchez Cordero, a former Supreme Court justice, applauded the ruling, saying on X that it represented an advance toward "a more just society in which the rights of all are respected." She called on Mexico's Congress to pass legislation in response.

But others in the highly religious country decried the decision. Irma Barrientos, director of the Civil Association for the Rights of the Conceived, said opponents will continue the fight against expanded abortion access.

"We're not going to stop," Barrientos said. "Let's remember what happened in the United States. After 40 years, the Supreme Court reversed its abortion decision, and we're not going to stop until Mexico guarantees the right to life from the moment of conception."

The court said on X that "the legal system that criminalized abortion" in Mexican federal law was unconstitutional because it "violates the human rights of women and people with the ability to gestate."

The decision came two years after the court ruled that abortion was not a crime in one northern state. That ruling set off a slow state-by-state process of decriminalizing it.

Last week, the central state of Aguascalientes became the 12th state to drop criminal penalties.

Abortion-rights activists will have to continue seeking legalization state by state, though Wednesday's decision should make that easier. State legislatures can also act on their own to erase abortion penalties.

For now, the ruling does not mean that every Mexican women will be able to access the procedure immediately, explained Fernanda Díaz de León, sub-director and legal expert for women's rights group IPAS.

What it does do — in theory — is obligate federal agencies to provide the care to patients. That's likely to have a cascade of effects.

Díaz de León said removing the federal ban takes away another excuse used by care providers to deny abortions in states where the procedure is no longer a crime.

It also allows women with formal employment who are part of the social security system and government employees to seek the procedure in federal institutions in states where the abortion is still criminalized, she said.

Díaz de León and officials at other feminist organizations worry that women, particularly in more conservative areas, may still be denied abortions.

"It's a very important step," Díaz de León said. But "we need to wait to see how this is going to be applied and how far it reaches."

Wednesday's ruling builds on previous wins for abortion rights

Across Latin America, countries have made moves to lift abortion restrictions in recent years, a trend often referred to as a "green wave," in reference to the green bandanas carried by women protesting for abortion rights in the region.

The changes in Latin America stand in sharp contrast to increasing restrictions on abortion in parts of the United States. Some American women were already seeking help from Mexican abortion rights activists to obtain pills used to end pregnancies.

Mexico City was the first Mexican jurisdiction to decriminalize abortion 15 years ago.

After decades of work by activists across the region, the trend picked up speed in Argentina, which in 2020 legalized the procedure. In 2022, Colombia, a highly conservative country, did the same.

The U.S. Supreme Court last year overturned Roe v. Wade, the 1973 ruling that provided a right to abortion nationwide. Since then, most states led by conservative lawmakers and governors have adopted bans or tighter restrictions.

The fact that the U.S. government is politically divided makes a nationwide ban or legalization unlikely, at least in the short term.

Currently, abortion is banned throughout pregnancy — with limited exceptions — in 15 American states. Bans in two more states forbid abortion after cardiac activity can be detected, generally around six weeks into pregnancy and often before women know they are pregnant. Judges have put enforcement of restrictions on hold in at least four additional states.

Meanwhile, states with liberal governments have taken steps to try to protect abortion access.

Observers in Mexico agreed that it would take time to see how Wednesday's ruling is applied.

In the southern state of Guerrero, Marina Reyna, director of the Guerrero Association Against Violence toward Women, cautioned that challenges would persist. Her state decriminalized abortion last year, but there are 22 open investigations against women accused of ending their pregnancies.

"There is still a lot of resistance," she said.

Copyright 2023 NPR. To see more, visit https://www.npr.org.