Why does President Donald Trump care about what gay people do in the bedroom?

The question came up this week, when a lawyer for Trump's Department of Justice argued that the Civil Rights Act of 1964 does not protect LGBT Americans from being fired because of their sexual orientation—a complete reversal of the government's position on such matters under previous presidents.

The Justice Department argument Tuesday, before the Second Circuit Court of Appeals, came in the case of Donald Zarda who claims he was fired by his company, Altitude Express, for being gay.

Related: Here's How Donald Trump Could Actually Be Impeached

The agency inserted itself, even though the federal Equal Employment Opportunity Commission had already sided with Zarda, arguing that LGBT employees are protected by Title VII of the landmark Civil Rights law.

That made the hearing odd, to say the least.

"It's a little bit awkward for us to have the federal government on both sides of the case," observed Judge Rosemary Pooler at one point in the oral arguments.

But Justice Department lawyer Hashim Mooppan pressed on anyway, opposing the EEOC, which was still run by an Obama administration holdover when the case first reached the court.

"Employers under Title VII are permitted to consider employees' out-of-work sexual conduct," Mooppan told the judges. "There is a common sense, intuitive difference between sex and sexual orientation."

The lawyer for Zarda's side disagreed in the most basic terms.

"(It's) as conservative as it could possibly get: if having sex with a man is okay for a woman, it has to be okay for a man as well," Greg Nevins of Lambda Legal, tells Newsweek. "You cannot apply a different rule based on gender, according to the law. Apparently, that wasn't conservative enough for the DOJ."

The Department of Justice has repeatedly railed against LGBTQ protections in multiple high-profile cases under Donald Trump and Attorney General Jeff Sessions.Reuters

The Justice Department argument reflects a "significant undermining of the Supreme Court's decision on marriage equality," Nevins added.

The arguments came as the full 13-judge Second Circuit reviews an earlier ruling by a three-judge panel in favor of Zarda's former employer. They also came after the Seventh Circuit Court of Appeals ruled in April that people can't be fired because they engage in gay sex.

But the law has been interpreted to include protections for sexual orientation for decades, after multiple lower level district courts concluded beginning in 2002 that employees could not be fired simply for being gay. The Seventh Circuit Court of Appeals affirmed in April that Title VII does in fact cover sexual orientation, noting that any other interpretation of the law would be "confusing and contradictory."

It's not the first time the Trump administration has moved to shred protections for gays.

Under Attorney General Jeff Sessions, the department has filed multiple amicus briefs arguing against LGBT protections, including one for the upcoming high-profile Supreme Court case, Masterpiece Cake Shop v. Colorado Civil Rights Commission. Earlier this month, Acting Solicitor General Jeffrey Wall defended Colorado baker Jack Philips, who was found guilty of violating the state's Anti-Discrimination Act when he refused to make a wedding cake for two men who were getting married even though he routinely makes such cakes for straight couples.

Philips argued his case on First Amendment grounds: as an artist and a Christian, he should not be forced to create a work of art that violates his beliefs. Defying lower courts, the Trump administration agreed.

"Forcing Phillips to create expression for and participate in a ceremony that violates his sincerely held religious beliefs invades his First Amendment rights," Wall wrote in a brief earlier this month.

Taken together, the Zarda and Masterpiece cases suggest to legal experts that the Trump administration is willfully targeting the gay community.

"It's nothing short of shocking," Louise Melling, deputy legal director of the American Civil Liberties Union, told The Washington Post. The administration, she said, "has already made its hostility" toward the LGBT community abundantly clear.

Nevins thinks he knows why—it's good politics for Trump.

"Trump touted his pro-LGBT credentials last year [but] one thing that's preserved what's left of his approval rating is that there are people who are happy with his administration fighting the good fight for them," he says. "It's going to play well for them, even if the DOJ is weighing in on losing sides and their arguments are contrary to even conservative notions."