North Carolina and the federal government are suing each other over whether the state's new transgender bathroom regulation violates federal civil rights laws. The cultural stakes are clear: the two governments have sharply different ideas about the acceptance of transgender people. But what about the legal stakes?

The legal problem in the case is whether the North Carolina law, which bars transgender people from restrooms, locker rooms and changing rooms, violates the provision of the Civil Rights Act of 1964 that prohibits discrimination on the basis of sex.

That question may sound simple, but it's actually profound. It will require a court to decide whether gender is the same thing as sex, and if so, for what purposes.

If this makes your head spin, let me start with a clarification of terminology that might make things worse before they can get better.

In academic discourse today, it's become conventional to distinguish between two conceptual categories, sex and gender.

"Sex" is (mostly) biological. Some combination of chromosomes (your genotype) and characteristics (your phenotype) determine whether to categorize you male, female, or intersex.

In contrast, "gender" is mostly treated as a social or cultural category of presentation, identity and self-description. The influential literary theorist Judith Butler famously called this "gender performance."

The idea is that a person born with X and Y chromosomes and male secondary sexual characteristics could still present herself as a woman by means of speech, dress, manner and more. That person's gender would be female while the same person's sex could be male.

It's a further convention that, as a marker of respect for individual choice, we would call that person "she."

At one time, it was common to hear academics say that while sex is rigidly specified, gender is fluid. Today most would agree that's too simple. Some aspects of biological sex can be changed, for example by taking testosterone or estrogen and by sex reassignment surgery. So sex in some ways is fluid.

And many people, including some transgender people, experience gender identity as rigidly given. It's conceivable that neurological development plays a role in shaping supposedly cultural aspects of gender. As a result, it turns out that it's also too simple to say that gender is always fluid, or even that it's entirely cultural as opposed to biological.

All that brings us to the legal question of whether a law that prohibits discrimination based on sex includes discrimination based on gender performance.

North Carolina says it isn't discriminating based on sex at all. Its law defines "biological sex" as "the physical condition of being male or female, which is stated on a person's birth certificate." The law restricts bathroom access to the sex on the person's birth certificate.

Notably, under North Carolina law, a person who has undergone sex reassignment surgery can get a new birth certificate that changes his or her sex. The law therefore doesn't discriminate against postoperative transsexuals, or at least those who bother to get their birth certificates changed.

What the law is doing is discriminating based on gender. If you identify with a sex not on your birth certificate, you can't use the bathroom associated with that sex. The law is targeted at transgender people, not transsexuals.

North Carolina says that when the Civil Rights Act was passed in 1964, no one would have confused discrimination based on sex, which is banned, with discrimination based on gender, which isn't.

The federal government says that this historical analysis misses the point. In its view, "sex" under the statute should be defined as gender. Vanita Gupta, the head of the civil rights division at the Department of Justice put it this way: "Transgender men are men - they live, work and study as men. Transgender women are women - they live, work and study as women. America protects the rights of all people to be who they are, to express their true selves and to live with dignity."

Gupta's formulation is about gender performance: how people "live, work and study" should define sex under the civil rights laws.

The Supreme Court has never addressed the conceptual relationship between sex and gender. In its opinions, it has used the terms interchangeably.

According to a famous story told by Justice Ruth Bader Ginsburg, when she was litigating early sex discrimination cases before the Supreme Court, her female secretary at Columbia Law School advised her that the word "sex" would be distracting to the male justices. "Don't you know that those nine men . their first association is not the way you want them to be thinking? Why don't you use the word gender?" She used the word "gender" instead, and the court followed suit without thinking about it.

The court has, however, thought hard about the view of human sexuality adopted by Justice Anthony Kennedy in gay rights cases, which emphasizes the "equal dignity" of all persons. The government's strongest argument is that the North Carolina law impugns the dignity of transgender people.

That's more of a constitutional argument than a statutory civil rights argument. But as Gupta's emphasis on self-expression and dignity suggest, it's at the core of how the government is presenting its case. If the federal courts take Kennedy's lead and treat transgender people like gay people, North Carolina's law is likely to be reversed.

Noah Feldman is a professor of constitutional and international law at Harvard.