SEOUL — After fighting for four years for women’s right to have an abortion, 21-year-old Kim Ye-rim felt “liberated” when a judge declared South Korea’s abortion ban unconstitutional on Thursday.

The verdict from Seoul’s Constitutional Court paves the way for South Korea to legalize abortion, knocking down one of the most stringent abortion bans in the developed world.

In a 7-to-2 vote, the Constitutional Court overturned a 66-year-old ban that denied abortion except in cases of rape, incest or danger to the mother’s health. The court ordered lawmakers to revise the abortion law by the end of 2020. The ban will remain in place until then.

Under the now-overruled regulation, women could be fined or jailed for a year for having abortions, while doctors who assist with the procedure could face up to two years in prison.

Outside, the verdict was met with cheers from abortion rights proponents and an outcry among opponents, led by a small but vocal minority of Catholics and other Christian denominations.

“Now a woman can be respected for her own decision about her body,” said Lee Yu-rim of the Sexual and Reproductive Rights Forum, addressing a rally in front of the court. Lee said the ruling sets a “historical milestone” that “calls an end to threats and reprisals that women faced” for seeking abortion.

On the other side of the court, abortion opponents brought a group of children to chant slogans and hold pictures of fetuses. The Rev. Yosep Joo of the National Coalition against Abortion denounced the court decision as “against humanity,” while antiabortion campaigners shouted “murderer” at the abortion rights activists.

A 2018 survey by the Korean Women’s Development Institute of 2,006 women ages 15 to 44 found 1 in 5 respondents had had an abortion — 97 percent of them illegally.

Lee Han-bon of Lawyers for a Democratic Society said individuals were rarely punished for abortion unless reported to police, usually by boyfriends or husbands seeking reprisal. “The premise of the abortion law was protection of unborn children, but in reality, the restriction just made women vulnerable to fear of punishment,” Lee said.

The antiabortion law was put in place in 1953 and has been selectively enforced.

Abortion was tacitly encouraged for decades after South Korea began its family planning campaign in 1960s with international assistance. A high birthrate was seen as an obstacle to economic growth and the modernization of postwar South Korea.

Koh Kyung-sim recalled that when he was a trainee obstetrician at a community health center in the mid-1980s, she performed “menstrual regulation” a dozen times each day. “This was essentially a form of abortion, but as it was provided as part of public health service from the government, no one knew it was illegal,” Koh said.

Fast-forward to the 2000s. The population control turned out to have worked too well, bringing fertility way below the two-child replacement level. In November 2009, the government announced a “comprehensive plan for low birthrate” that included a crackdown on abortion. Later that year, a group of physicians formed the Pro-Life Doctors Association and started naming clinics performing abortion. “The government turned from encouraging to discouraging abortion as societal needs changed, subjecting a woman’s body to arbitrary interference from the state at political whim,” Koh said.

The sudden crackdown did not lead to a spike in prosecutions, but it sent a chill among doctors and the price of the procedure soared.

When 17-year-old Kim sought to terminate her pregnancy in 2015, she had to approach about a dozen ob-gyns before finding one willing to perform an abortion. Although it is illegal, many ob-gyns in South Korea perform abortion on an unofficial basis.

Kim said she had to pay 800,000 won ($700), an entire month’s salary from her part-time job. “I was cornered into this financially and mentally draining experience. The crippling burden imposed by legal and societal restrictions falls entirely on a woman seeking abortion,” she said.

Yoon Jung-won, an obstetrician at Green Hospital in Seoul, said the criminalization of abortion complicated access to the procedure, making it too risky and expensive for those in need. “The court decision to lift the ban should be followed with policies to make abortion accessible to women through insurance coverage and such,” said Yoon, who leads the Women’s Council at the Association of Physicians for Humanism.

Antiabortion activists, however, said decriminalizing abortion will lead to the “murder of unborn babies.”