NEW YORK—The U.S. Court of Appeals for the 2nd Circuit had a burning question for Donald Trump’s Department of Justice on Tuesday: What are you doing in our courthouse? By the end of the day, the answer still wasn’t clear. Something else was, though: The DOJ’s new anti-gay legal posture is not going to be received with open arms by the federal judiciary.

The Justice Department’s latest wound was fully self-inflicted, as Tuesday’s arguments in Zarda v. Altitude Express should not have involved the DOJ in the first place. The case revolves around a question of statutory interpretation: whether Title VII of the Civil Rights Act of 1964 outlaws anti-gay workplace discrimination. Title VII bars employment discrimination “because of sex,” which many federal courts have interpreted to encompass sexual orientation discrimination. The 2nd Circuit is not yet one of them, and Chief Judge Robert Katzmann signaled recently that he would like to change that. So on Tuesday, all of the judges convened to consider joining the chorus of courts that believe Title VII already prohibits anti-gay discrimination in the workplace.

It’s important to understand some background before getting further into how those arguments went. The Equal Employment Opportunity Commission decided in 2015 that Title VII’s ban on sex discrimination does protect gay employees. Under President Barack Obama, the Justice Department took no position on this question. But in late July, Attorney General Jeff Sessions’ DOJ unexpectedly filed an amicus brief in Zarda arguing that Title VII does not protect gay people. The 2nd Circuit had not solicited its input, making the brief both puzzling and gratuitous. Its purpose only became apparent in September, when the DOJ filed a similarly uninvited brief asserting that bakers have a free speech right not to serve same-sex couples. Both anti-gay briefs were startlingly incoherent, seemingly the product of political pandering rather than legal reasoning.

Regardless, the DOJ’s decision to weigh in on Zarda ensured that oral arguments would include the weird spectacle of one federal agency opposing another in court. That doesn’t happen often—and really shouldn’t happen—because the executive branch is expected to speak with one voice on legal affairs. But the EEOC’s commissioners serve fixed terms and haven’t gotten the memo placing politics above the law yet. And so they were not exactly delighted to see political appointees at the Justice Department trash their theories in court on Tuesday when the two agencies faced off over what it means to discriminate “because of sex.”

Arguments dragged on for nearly two hours, but EEOC attorney Jeremy D. Horowitz seized the upper hand early by capably explaining the agency’s three theories:

1. The “but-for” theory

This argues that anti-gay discrimination qualifies as sex discrimination because, but for the gay person’s sex, he would not suffer discrimination. For instance, consider a homophobic employer who fires a male employee because he marries a man. But for that employee’s sex, he wouldn’t have been discriminated against and lost his job.

2. The sex stereotyping theory

In 1989’s Price Waterhouse v. Hopkins, the Supreme Court ruled that sex stereotyping—punishing a worker for her failure to conform to gender norms—is a kind of sex discrimination. At first, courts only applied sex stereotyping to masculine women and feminine men. But as the 7th U.S. Circuit Court of Appeals explained in March, gay people are “the ultimate case of failure to conform” to sex stereotypes, since men and women are typically expected to date only individuals of the opposite sex.

3. The associational sex discrimination theory

This holds that anti-gay bias constitutes sex discrimination much like anti-miscegenation laws constituted race discrimination. When states prohibited a white person from marrying a black person, they were committing discrimination because of race. It follows that when an employer punishes a gay person for associating with a same-sex partner, he has committed discrimination “because of sex.”

Horowitz made his case well, forcefully elucidating why “sexual orientation cannot be separated from sex.” Still, Judge Rosemary Pooler couldn’t resist drawing his attention to the strangeness of the arguments.

“We love to hear from the federal government,” she told Horowitz, “but it’s a bit awkward to hear from them on both sides.”

“Indeed, your honor,” he responded, deadpan. Everybody laughed, but the fun was just beginning. Following Horowitz’s staid performance, Lambda Legal’s Greg Nevins stepped up to the lectern. Nevins, limber and witty before the judges, used his 10 minutes to bash the DOJ before Deputy Assistant Attorney General Hashim M. Mooppan had a chance to make his case. Mooppan’s position, Nevins asserted, was a “radical reinterpretation of Title VII” that rests on a “parlor trick.”

That set the stage for Mooppan’s appearance, which, to put it mildly, did not go well at all. Chief Judge Katzmann immediately wanted to know: Why didn’t the DOJ defer to the EEOC on Title VII, as it normally does? Mooppan’s basic reply was that the Justice Department is the nation’s “largest employer”—meaning, in short, that it has an interest in retaining its capacity to fire gay people for being gay.

“What is the process with regard to the EEOC and the DOJ in terms of filing a brief?” Katzmann followed up.

“That’s a complicated question,” Mooppan responded.

“Try to help us,” Katzmann implored. He also wanted to know what career attorneys at the DOJ’s civil rights division think about the agency’s position. But Mooppan wouldn’t answer: “That’s not appropriate for me to disclose,” he told the judge. Katzmann looked alarmed. Judge Pooler jumped in: “Does the Justice Department sign off on a brief that EEOC intends to file?” she wondered.

“That’s not appropriate for me to disclose,” Mooppan repeated.

“It’s procedure, not internal deliberations,” Pooler responded.

“I don’t think it’s appropriate,” Mooppan said again, stonewalling. Now a majority of the judges looked irritated. As a general rule, attorneys are supposed to answer questions posed by the court, not dodge them as though they’re taking the Fifth. It was a terrible start for Mooppan, and both Pooler and Katzmann looked genuinely perplexed that a DOJ attorney would show such blatant disrespect. Finally, Judge Dennis Jacobs broke the impasse: “I, for one, am prepared to proceed on the assumption that you’re here,” he said.

Mooppan laughed, but it only went downhill from there. Mooppan’s theory is basically this: Sex discrimination must always involve a belief that one sex is inferior to the other. Anti-gay discrimination does not rest on such a belief, and so it is not sex discrimination. This theory is quite bad for several reasons, but the most obvious one is that decades of case law disprove it. The Supreme Court has never held that an employer must express animus toward one sex in order to violate Title VII. He need only take sex into account in any adverse employment action to run afoul of the law.

Judge Jacobs asked Mooppan whether he can refute the EEOC’s associational discrimination theory and its parallel to interracial and interfaith marriage.

“When you discriminate against interracial marriage,” Mooppan responded, you are promoting “racial superiority.” When you discriminate against interfaith marriage, you are promoting “religious superiority.” That makes the comparison to homosexuality moot.

What? Jacobs looked stumped, and Mooppan’s argument seemed to have demonstrated that the Lambda Legal attorney was correct—the DOJ really is peddling a “radical reinterpretation of Title VII.” This whole idea of superiority is nowhere to be found in Title VII or relevant Supreme Court precedent. An employer who discriminates against a Chinese worker for marrying a Native American person is still engaging in illegal race discrimination even if he thinks both races are perfectly equal. Title VII does not simply outlaw certain forms of workplace animus. It singles out certain traits—race, religion, sex—and bars employers from taking them into account. Mooppan is simply wrong to argue that an employer must hate a certain race or sex or religion in order to violate Title VII.

When arguments concluded, it seemed inevitable that the court would agree with the EEOC, reject the DOJ’s wackadoodle theories, and find that Title VII already proscribes anti-gay employment discrimination. After Tuesday’s performance, the Justice Department’s involvement in the case may have actually swung a judge or two away from its position; its flagrantly political intrusion seemed to irk even the Republican appointees. Anti-gay activists may have taken control of the DOJ—but they seem unlikely to persuade the 2nd Circuit that America’s gay employees don’t deserve civil rights.