The litigation over North Carolina’s law concerning access to bathrooms ultimately turns on a basic question: How is a person’s sex determined? Title VII of the 1964 Civil Rights Act prohibits employment discrimination based on sex. Title IX of the Education Act Amendments of 1972 prohibits educational institutions that receive federal funds from discriminating based on sex. The legal question now pending in federal court is whether discriminating against transgender individuals is sex discrimination and if so, whether it is justified.

I have no doubt as to the answer: the Obama administration will win this litigation and, relatively, soon society will widely accept that transgender individuals should not be discriminated against, including in their use of restrooms.

Charlotte, N.C., passed an ordinance that prohibited discrimination based on gender identity, in bathrooms and other places of public accommodation. In response, the North Carolina Legislature adopted a law, which among other things, mandates that all “public agencies” require that “all multiple occupancy bathrooms or changing facilities be designated for, and only be used by, individuals based on their biological sex.” The law, H.B. 2, defines “biological sex” as “[t]he physical condition of being male or female, which is stated on a person’s birth certificate.”

The Obama administration warned North Carolina that H.B. 2 was impermissible sex discrimination. On May 9, North Carolina filed suit in federal court against the federal government to have H.B. 2 declared lawful. The same day, the U.S. Justice Department filed a lawsuit to have H.B. 2 declared invalid as violating federal law. Earlier, civil rights groups, including the ACLU and Lambda Legal Defense and Education Fund, sued to challenge the North Carolina law.

On Friday, the Justice Department and the Department of Education sent a directive to public school districts and universities to allow transgender students access to bathroom facilities that correspond to their gender identity. Although non-binding, schools that fail to comply with the administration’s guidance could potentially face lawsuits or reduced federal aid.

The rhetoric surrounding this litigation is angry. But the legal question is straightforward: When is a person discriminated against on account of sex? North Carolina claims that a person’s sex is determined by the genitalia that are observed at birth and the basis for the choice recorded on the birth certificate. But North Carolina is likely to lose this claim in the courts because it is far too simplistic.

As the Justice Department explains in its lawsuit, an individual’s sex consists of multiple factors, including hormones, external genitalia, internal reproductive organs, chromosomes and gender identity. Ultimately, gender identity is the primary factor in determining a person’s sex.

Thus, a person who identifies as male but is kept from using the male restroom is being discriminated against solely on account of his sex. Keeping a transgender female from using the women’s restroom is discriminating against her because of her sex. By definition, that is sex discrimination and violates federal law.

The case law supports this and the United States in its suit against North Carolina. For example, in April, the 4th U.S. Circuit Court of Appeals – whose jurisdiction includes North Carolina – held that a Virginia school board’s policy barring a transgender boy from using the boy’s restrooms at his school violates Title IX’s ban on discrimination on the basis of sex. This decision is binding on the federal courts in North Carolina.

Of course, the prohibition of sex discrimination is not absolute. Title VII, which prohibits employment discrimination, provides that sex can be used in employment decisions if it is a “bona fide occupational qualification.” North Carolina contends that its law is justified to keep men from using the women’s restroom and assaulting women and girls. Preventing sexual assault is obviously vitally important, but the problem for North Carolina is that there is no evidence at all that permitting transgender individuals to use the restroom of their choice poses the slightest risk. Countless schools across the country have allowed individuals to use facilities based on their gender identity and there have been no problems. Los Angeles Unified School District has followed this policy since 2005 and all California schools since 2013.

I am confident that the North Carolina law will be struck down and that, ultimately, society will accept transgender individuals using the restroom of their choice. Attorney General Loretta Lynch eloquently expressed this when she declared: “This action is about a great deal more than just bathrooms. This is about the dignity and respect we accord our fellow citizens, and the laws that we, as a people and as a country, have enacted to protect them – indeed, to protect all of us. It’s about the founding ideals that have led this country – haltingly but inexorably – in the direction of fairness, inclusion and equality for all Americans. This is not a time to act out of fear. This is a time to summon our national virtues of inclusivity, diversity, compassion and open-mindedness. What we must not do – what we must never do – is turn on our neighbors, our family members, our fellow Americans, for something they cannot control, and deny what makes them human.”

Erwin Chemerinsky is dean of the UC Irvine School of Law.