Updated

A South Korean court on Thursday abolished a 62-year-old law that criminalized extramarital affairs, and the stock price of a prominent condom maker immediately shot up 15 percent.

The Constitutional Court's ruling that the law suppressed personal freedoms could affect many of the more than 5,400 people who have been charged with adultery since 2008, when the court earlier upheld the legislation, according to court law.

Any current charges against those people could be thrown out and those who have received guilty verdicts will be eligible for retrials, according to a court official who declined to be named, citing office rules.

Under the law, having sex with a married person who is not your spouse was punishable by up to two years in prison. Nearly 53,000 South Koreans have been indicted on adultery charges since 1985, but prison terms have been rare.

The stock price of South Korean condom maker Unidus Corp. shot up after the court ruling, surging by the daily limit of 15 percent on South Korea's Kosdaq market.

Debate over the adultery ban, which has been part of South Korea's criminal law since 1953, intensified in recent years as fast-changing social trends challenged traditional values.

Supporters of the law said it promoted monogamy and kept families intact, while opponents argued that the government had no right to interfere in people's private lives and sexual affairs.

The court was acting on 17 complaints submitted from 2009 to 2014 by people who had been charged under the law.

Seven judges in the court, which rules on the constitutionality of laws, supported the ruling, while two dissented, the court said. The support of six judges is needed to abolish a law.

The law "excessively restricts citizens' basic rights, such as the right to determine sexual affairs," the court said, explaining that the legislation no longer contributed to overall public interest.

It was the fifth time the court had reviewed the adultery ban since 1990. In October 2008, five of the judges said the law was unconstitutional.

Legal experts say the adultery ban had lost much of its effect because people increasingly settled marriage disputes in civil courts. Adultery could be prosecuted only on a complaint made by a spouse who had filed for divorce. The case immediately ended if the plaintiff dropped the charge, which was common when financial settlements were reached.

"Recently, it was extremely rare for a person to serve a prison term for adultery," said Lim Ji-bong, a law professor at Sogang University in Seoul. "The number of indictments has decreased as charges are frequently dropped."

South Korea, along with Taiwan, had been a rare non-Muslim nation to criminalize adultery, according to Park So-hyun, an official at the Korea Legal Aid Center for Family Relations, a government-funded counseling office.

Many legal experts had predicted that the court would abolish the adultery ban, but the decision was still controversial in a country that remains greatly influenced by a conservative Confucian heritage, despite decades of Western influence.

Park Dae Chul, a lawmaker for the conservative ruling party, Saenuri, said it respects the court's decision but that the country needs to strengthen its efforts to protect marriage and the family system.

Lawmaker Yoo Eun Hye of the liberal opposition New Politics Alliance for Democracy said the decision reflected social changes.

Last year the government banned access to Ashley Madison, a dating website for people who want to cheat on their partners, over concerns that the service could encourage adultery. The Korea Communications Standards Commission, the country's Internet censorship body, said it has not decided whether to lift the ban on the website.