A judge ruled that a Montana law which defined "sex" in state law, when referring to a person as only male or female, was unconstitutional, saying that the law's description did not explicitly state its purpose.

District Court Judge Shane Vannatta struck down the 2023 law on Tuesday after a group of plaintiffs who identify as transgender, nonbinary, intersex and other identities sued, arguing the law denies legal recognition and protection to people who identify as gender-nonconforming, according to The Associated Press.

Vannatta did not address the claim of a lack of legal recognition and protection, but did say that the bill's title did not adequately explain whether the word "sex" referred to gender or sexual intercourse and that it did not indicate the words "male" and "female" would be defined in the body of the bill.

"The title does not give general notice of the character of the legislation in a way that guards against deceptive or misleading titles," Vannatta wrote.

BIDEN OFFICIALS PUSHED TO DROP AGE LIMIT ON TRANS SURGERIES FOR MINORS: REPORT

Demonstrators gather on the steps of the Montana State Capitol

A judge ruled that a Montana law that defined "sex" in state law, when referring to a person, as only male or female was unconstitutional. (AP)

Montana's law, S.B. 458, is similar to ones passed in Kansas and Tennessee.

The bill sought to revise laws to "provide a common definition for the word sex when referring to a human," the text reads.

It defines "male" as "a member of the human species who, under normal development, has XY chromosomes and produces or would produce small, mobile gametes, or sperm, during his life cycle and has a reproductive and endocrine system oriented around the production of those gametes."

"Female" was defined in the bill as "a member of the human species who, under normal development, has XX chromosomes and produces or would produce relatively large, relatively immobile gametes, or eggs, during her life cycle and has a reproductive and endocrine system oriented around the production of those gametes."

Transgender pride flag

Plaintiffs who identify as transgender, nonbinary, intersex and other identities sued, arguing the law denies legal recognition and protection to people who identify as gender-nonconforming. (ALLISON DINNER/AFP via Getty Images)

The law was sponsored by Republican state Sen. Carl Glimm, who said the legislation was needed after a state judge ruled in 2022 that transgender people could change the gender markers on their birth certificates.

Republican Gov. Greg Gianforte is proud of the law he signed, which he said codified the long-recognized and commonsense definition of sex, the governor's spokesman Sean Southard told The Associated Press.

"Words matter. And this administration is committed to ensuring words have meaning, unlike this judge, who apparently needs a dictionary to discern the difference between a noun and a verb," Southard said.

Montana Attorney General's Office spokeswoman Emilee Cantrell said her office would continue to defend the law "that reflects scientific reality."

TRANSGENDER ATHLETE COMPLAINS ABOUT LACK OF SPORTSMANSHIP FROM FELLOW RUNNERS AFTER WINNING GIRLS STATE TITLE

Gianforte

Republican Gov. Greg Gianforte is proud of the law he signed, a spokesman for his office said. (Garrett Turner/Office of the Governor)

CLICK HERE TO GET THE FOX NEWS APP

The American Civil Liberties Union of Montana applauded the ruling.

"Today's ruling is an important vindication of the safeguards that the Montana Constitution places on legislative enactments," ACLU of Montana legal director Alex Rate said.

The bill was passed in 2023 during a legislative session when a ban on gender transition treatment for minors was also approved and when transgender Democrat state Rep. Zooey Zephyr was expelled from the House floor after a protest against Republican lawmakers who had silenced the Democrat.

The Associated Press contributed to this report.