The Department of Justice has filed court papers arguing that a major federal civil rights law does not protect employees from discrimination based on sexual orientation, taking a stand against a decision reached under former President Barack Obama.

The department’s move to insert itself into the New York case was an uncommon example of top officials in Washington opining directly in the courts on what is an important but essentially private dispute between a worker and his boss over gay rights issues. Civil rights advocates immediately criticized the filing not only for the arguments it advanced, but also for having been made on the same day that President Trump announced on Twitter that transgender people would be banned from serving in the military.

The department’s amicus brief was filed on Wednesday in the Second Circuit appeals court in the case of Donald Zarda, a sky diving instructor. In 2010, Mr. Zarda was fired by his employer, a Long Island-based company called Altitude Express. Before taking a female client on a tandem dive, Mr. Zarda told the woman he was gay to assuage any awkwardness that might arise from the fact that he would be tightly strapped to her during the jump. The woman’s husband complained to the company, which subsequently fired Mr. Zarda. Mr. Zarda then sued Altitude Express, claiming it had violated Title VII of the 1964 Civil Rights Act, which bars discrimination in the workplace based on “race, color, religion, sex or national origin.”

Under Attorney General Jeff Sessions, the Justice Department has now stepped into the fray, as BuzzFeed reported on Wednesday night. In its court brief, the department noted that every Congress since 1974 has declined to add a sexual-orientation provision to Title VII, despite what it called “notable changes in societal and cultural attitudes.” The brief also claimed that the federal government, as the largest employer in the country, has a “substantial and unique interest” in the proper interpretation of Title VII.

“The sole question here is whether, as a matter of law, Title VII reaches sexual orientation discrimination,” the brief said. “It does not, as has been settled for decades. Any efforts to amend Title VII’s scope should be directed to Congress rather than the courts.”

In 2015, the Equal Employment Opportunity Commission, under Mr.Obama, issued a very different ruling, deciding on a vote of three Democrats to two Republicans that discrimination on the basis of sexual orientation was illegal. That ruling, which was reviewed by the Obama administration’s Justice Department, did not formally bind the federal courts, although courts often defer to federal agencies when they interpret laws that come under their jurisdiction.

But in its brief, the Trump administration’s Justice Department said that the E.E.O.C., which has also filed court papers supporting Mr. Zarda, was “not speaking for the United States.”

In 2014, Eric Holder, Mr. Obama’s attorney general, issued a memo stating that in any litigation that came before it, the Justice Department would take the position that the protections afforded by Title VII would be extended to include a person’s gender identity, including transgender status. The future of that memo under Mr. Trump remains unclear.

A lower court on Long Island first considered Mr. Zarda’s case in 2015 and ruled against him, deciding, despite the E.E.O.C. ruling, that sexual orientation was not included in the civil rights law’s prohibition against discrimination based on “sex.” In April, the Second Circuit in New York upheld that court’s decision, even though it noted that there was “a longstanding tension in Title VII case law.”

Federal appeals courts have issued contradictory rulings on the matter. In 2000, while considering the case of a Long Island postal worker, Dwayne Simonton, who was abused at work for being gay, the Second Circuit ruled that the language of Title VII did not bar discrimination based on sexual orientation. The ruling also noted that Congress has repeatedly declined to include such a provision in the law.

“There can be no doubt that the conduct allegedly engaged in by Simonton’s co-workers is morally reprehensible,” the court wrote in 2000. It added, however, that “the law is well-settled in this circuit.”

Shortly after the new brief was filed, civil rights advocates attacked it. In a statement on Wednesday, Vanita Gupta, who ran the Justice Department’s civil-rights division under Mr. Obama, said that the Trump administration’s court filing “contravenes recent court decisions and guidance issued by the Equal Employment Opportunity Commission.”

On Twitter on Wednesday night, Ms. Gupta, who is the president of the Leadership Conference on Civil and Human Rights, noted that only political appointees, not career employees, from her former office at the Justice Department had signed the brief.

The American Civil Liberties Union called the brief a “gratuitous and extraordinary attack on L.G.B.T. people’s civil rights.” In a statement, James Esseks, the director of the organization’s L.G.B.T. and H.I.V. Project, added, “The Sessions-led Justice Department and the Trump administration are actively working to expose people to discrimination.”

In his own statement, Devin O’Malley, a Justice Department spokesman, said that the brief was “consistent with the Justice Department’s longstanding position and the holdings of 10 different courts of appeals.”

Mr. O’Malley added that the filing “reaffirms the department’s fundamental belief that the courts cannot expand the law beyond what Congress has provided.”