The Iowa Supreme Court unanimously ruled on Friday in favor of two transgender women, effectively striking down the state’s ban on Medicaid coverage for sex reassignment surgery.

The case involved EerieAnna Good and Carol Anne Beal, two women whose medical providers determined that sex reassignment surgery was necessary to treat their gender dysphoria. Yet when Good and Beal — who have identified as female since childhood — sought to have surgery under the state’s Medicaid program, they were denied. They appealed to the state agency, which oversees the program, but were rejected again.

“So many people still don’t understand that this is not something we need for trivial or cosmetic reasons,” Good said. “It’s medical care a doctor is recommending for someone who has a medical need for it."

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Good and Beal sued the agency in 2017. In June, Judge Arthur Gamble of the Judicial District 5 Court ruled that a 1995 Iowa Department of Human Services policy denying Medicaid coverage for sex reassignment surgery violates the state’s 2007 Civil Rights Act, which added gender identity to the state’s list of protected classes.

In its appeal, the agency argued that its policy wasn’t discriminatory because neither transgender nor non-transgender individuals were able to use Medicaid benefits for gender-reassignment surgery, which it said is performed “primarily for psychological purposes.” It also argued that the policy’s explicit exclusion of gender-reassignment surgeries was an example of “cosmetic, reconstructive, and plastic surgeries” that are excluded from coverage.

Yet the Iowa Supreme Court upheld the lower court’s decision on Friday, arguing that Good and Beal were denied sex reassignment surgery because they were “related to gender identity disorders.” It also asserted that Medicaid does authorize payment for some cosmetic surgeries that serve psychological purposes, such as to help disfiguring scarring and congenital anomalies.

The Iowa Department of Human Services did not respond to NBC News' request for comment.

“We are extremely happy with this ruling,” Rita Bettis Austen, the legal director of the American Civil Liberties Union of Iowa, said at a press conference on Friday afternoon. “This is the first decision by the Iowa Supreme Court that affirms the rights of transgender Iowans to non-discrimination under the Iowa Civil Rights Act.”

Medical experts from the American Medical Association agree that gender dysphoria, which occurs when a person’s assigned sex and gender at birth do not match their gender identity, is a serious medical condition that can be life-threatening if left untreated.

"I’ve lost transgender friends to suicide," Good said. "I hope this decision helps change that.”

After today’s decision, 11 states and the District of Columbia currently cover transition-related surgical care through their public health insurance programs, according to the ACLU.

“Through our work with transgender Iowans, we have seen firsthand how powerful, life-changing, and absolutely essential gender-affirming surgery can be for transgender people grappling with gender dysphoria,” Daniel Hoffman-Zinnel, the executive director of One Iowa, an LGBTQ advocacy organization, said. “This decision will, quite literally, save lives."

FOLLOW NBC OUT ON TWITTER, FACEBOOK & INSTAGRAM.