If two men are violently attacked for kissing each other in public, is that a form of sex discrimination?

Prosecutors in a prominent West Virginia case argued that it is, because if one of those men were female, the alleged homophobic assault would not have occurred. But on Wednesday, the state's Supreme Court decided gay people are not protected by West Virginia hate crime law — ruling that sexual orientation is not a form of sex discrimination.

2017 West Virginia Supreme Court members; Front row: Justice Robin Davis; Chief Justice Allen H. Loughry II; Justice Margaret Workman; Back row: Menis Ketchum; Elizabeth Walker. Richard S Lee / West Virginia Judiciary

West Virginia law makes it a felony to injure or intimidate someone because of their race, color, religion, ancestry, national origin, political affiliation or sex. Sexual orientation and gender identity are not listed as protected classes.

According to Wednesday's court opinion, gay couple Zackary Johnson and Casey Williams were visiting Huntington, W.V., on April 5, 2015. The couple stopped to kiss on the sidewalk, and a man in a nearby car started taunting them with homophobic slurs. Steward Butler, then a 23-year-old star running back with Marshall University's football team, allegedly got out of the car and punched both Johnson and Williams, knocking Williams to the ground.

Cell phone footage showed the attack. Butler was arrested, charged with two counts of misdemeanor assault, then indicted by a jury on felony charges under the state's hate crime law.

But in a highly unusual move, the West Virginia Attorney General's office — normally tasked with arguing for the county prosecutor — filed a brief in defense of the football player. That pitted the state against itself, essentially, in court.

"I’ve never seen it happen before," Cabell County Assistant Prosecutor Lauren Plymale told NBC News over the phone on Thursday. "They usually represent us."

Plymale argued before the state Supreme Court that discrimination on the basis of sex and gender would naturally extend to include lesbian, gay, bisexual and transgender people.

The Morning Rundown Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"We believe this is based on sex. If either of the individuals were female, [Butler] would’t be there. And it’s gender stereotyping: The men weren’t conforming to the defendant's idea of what a man should do," Plymale said.

The circuit court disagreed, saying in May 2016 that sex and sexual orientation are two distinct categories — and if the West Virginia legislature had meant for sexual orientation to be protected by law, they would have written it in.

Solicitor General Elbert Lin argued the case for the Attorney General and said sexual orientation should not be considered sex discrimination. Lin’s background includes two law clerk stints for conservatives judges — U.S. Supreme Court Justice Clarence Thomas and William Pryor of the U.S. Circuit Court of Appeals for the 11th Circuit. The latter once filed a brief in Lawrence v. Texas arguing that decriminalizing gay sex would "logically extend" to "prostitution, adultery, necrophilia, bestiality, incest and pedophilia.”

In a 25-page opinion issued Wednesday, the West Virginia Supreme Court noted that several attempts to get sexual orientation added to the state's hate crime law had failed.

"It is certainly not absurd for this Court to recognize not only the Legislature's right to define crimes and their punishment, but also the Legislature's indisputable intent not to expand West Virginia Code to include 'sexual orientation,'" the opinion delivered by Chief Justice Allen Loughry stated.

Justice Margaret Workman, joined by Justice Robin Jean Davis, filed a dissenting opinion. In her dissent, Workman compared discrimination against someone with a same-sex partner to discrimination against mixed-race couples. In both cases, she wrote, a person is punished not because of their own sex or race per se — but because they are stepping outside of behavior typical to their own sex or race.

"If a man stands on a corner kissing a man and is beaten because he is kissing a man, has he been assaulted because of his sex? Yes, but not simply because he possesses male anatomical parts; rather, the crime occurred because he was perceived to be acting outside the social expectations of how a man should behave with a man," Workman wrote.

"But for his sex," Workman added, "He would not have been attacked."

The West Virginia case comes at a time when courts nationwide are questioning the definition of "sex."

Last week, the Health Department filed a notice saying it may overturn Obamacare's rule banning discrimination in health care. The department cited controversy over the way sex discrimination was defined by the Obama administration to include protections for transgender people and women seeking access to birth control or abortion.

Lambda Legal attorney Greg Nevins, who directs the firm's Fair Employment Project, told NBC News the principles in the West Virginia case are similar to the Hively v. Ivy Tech case he recently won at the 7th Circuit Court of Appeals. In that case, Nevins argued Hively was fired because she's a lesbian — and that Title VII's ban on sex discrimination protected her from sexual orientation discrimination by default.

Nevins and Lambda Legal also filed a brief in the West Virginia case, he said, but were not allowed to participate in oral arguments.

"The argument is, are you discriminating against someone or treating them differently because of their sex," Nevins said. "Is it objectionable to you that a man is kissing a man instead of a woman kissing a man? If the answer is yes, that’s about sex."

The West Virginia Supreme Court ruling is final, both Nevins and Plymale said. Now, it will take legislation to ensure LGBTQ people are protected by the state's hate crime law.

In the meantime, sexual orientation and gender identity are protected by federal hate crime law — but not every violent assault becomes a federal case.

Plymale said the misdemeanor charges against Butler are "still going forward."

Follow NBC Out on Twitter, Facebook and Instagram