BOISE, Idaho — When allegations erupted this summer that two Idaho lawmakers were caught in an extramarital affair, many supporters were quick to say their actions were a mistake, not a crime.

However, in Idaho, adultery has been considered a felony since 1972. The crime is rarely prosecuted, but it remains on the books as a relic of America’s long history of regulating sexual activity inside marriage.

Historically, adultery has been criminalized as a way to control the public’s behavior, says Elizabeth Brandt, a University of Idaho law professor.

Much like the era of Prohibition at the turn of the century, the strict laws were seen as a way to reduce threats to marriage. Today, that fear has waned despite adultery still remaining a crime, Brandt said.

“The law wasn’t changing behavior, and behavior eventually changed the law,” she said.

Adultery is illegal in 21 other states, but Idaho is one of a few to classify it as a felony. If prosecuted to the full extent of the law, a person could spend up to three years in prison and be fined up to $1,000. That’s harsher than the punishment for violating most of Idaho’s campaign finance or animal cruelty laws.

There is no statewide data on how often adultery charges are filed, and it is not included in the annual Idaho State Police crime report.

If adultery charges ever come into play in prosecutions, it’s likely because they are being used as a bargaining chip in a plea agreement, Twin Falls County Prosecutor Grant Loebs said. However, he could not recall using the charge in his nearly 25 years in the prosecutor’s office.

For example, in 2002, a 20-year-old Jerome man was sentenced to a year’s probation for a felony adultery charge for having a relationship with a 17-year-old married teenager. Prosecutors offered the adultery charge as a plea deal, meaning the man didn’t have to register as a sex offender because all other sex-related charges were dropped.

Idaho’s adultery law has not been amended since it was passed more than four decades ago, and there has been no major effort to repeal it.

“It’s there because the Idaho Legislature is making a statement that (adultery) should be discouraged,” Loebs said. “If you try to remove it, you’re asking should we make this type of behavior OK.”

Accusations arose last month in a conservative blog that Republican Rep. Christy Perry of Nampa and Sen. Jim Guthrie of McCammon were having an affair. The two will have to see if lawmakers call for a formal ethics investigation during the 2017 session.

Neither Perry nor Guthrie have commented on the specific allegations. However, Perry released a statement shortly after the blog post came out saying she made a “terrible mistake” two years ago with a friend in the Legislature. She did not name the friend and denied the blog’s overall allegations.

Guthrie filed for divorce last year, and it was finalized in July. According to court documents, Guthrie’s wife cited an affair as the reason for the split.