WASHINGTON — The Supreme Court on Thursday unanimously ruled in favor of a straight woman who twice lost positions to gay workers, saying an appeals court had been wrong to require her to meet a heightened burden in seeking to prove workplace discrimination because she was a member of a majority group.

The decision came two years after the Supreme Court struck down race-conscious admissions programs in higher education and amid the Donald Trump administration’s fierce efforts to root out programs that promote diversity. The ruling will place further pressure on employers and others to eliminate affirmative action and other initiatives that seek to provide opportunities to members of historically disadvantaged groups.

Nearly half of the federal appeals courts had required white people, men and other members of majority groups to meet a more demanding standard when they sued for workplace discrimination. In eliminating that requirement, the court said that a federal civil rights law demanded equal treatment of all individuals.

The standard for proving workplace discrimination under the law, Justice Ketanji Brown Jackson wrote for the court, “does not vary based on whether or not the plaintiff is a member of a majority group.”

The case was brought by Marlean A. Ames, who had worked for the Ohio Department of Youth Services, which oversees parts of the state’s juvenile corrections system. After a decade there, in 2014 she became the administrator of a program addressing prison rape. Five years later, she applied for a promotion.

Her supervisors turned her down, saying she lacked vision and leadership skills. They eventually gave the position to a gay woman who had been at the department for a shorter time and, unlike Ames, lacked a college degree.

Not long after denying her the new position, her supervisors removed her from her existing job, telling her that they had concerns about her leadership and offering her a demotion that came with a substantial pay cut. She was replaced by a gay man with less seniority.

Ames sued under a federal civil rights law that forbids employment discrimination based on, among other characteristics, sex. (The Supreme Court ruled in 2020 that discrimination based on sexual orientation is a form of sex discrimination for purposes of the civil rights law.)

The text of the law, Title VII of the Civil Rights Act of 1964, does not draw distinctions based on whether the person claiming discrimination is a member of a majority group. But some courts have required plaintiffs from majority groups to prove an additional element if they lack direct evidence of discrimination: “background circumstances that support the suspicion that the defendant is that unusual employer who discriminates against the majority.”

Lower courts ruled against Ames on those grounds. The 6th U.S. Circuit Court of Appeals, in Cincinnati, said she could have satisfied the “background circumstances” requirement by showing that decisions about her employment were made by “a member of the relevant minority group (here, gay people)” or with statistical evidence. But the appeals court said Ames had provided neither kind of proof.

(In the trial court, she said the two supervisors who took negative employment actions against her were straight. On appeal, she said a gay supervisor had also played a role. The appeals court ruled that she had forfeited that argument by not making it sooner.)

Jackson wrote that the text of the civil rights law “draws no distinctions between majority-group plaintiffs and minority-group plaintiffs.”

Indeed, she wrote, “by establishing the same protections for every ‘individual’ — without regard to that individual’s membership in a minority or majority group — Congress left no room for courts to impose special requirements on majority-group plaintiffs alone.”

Conservative legal groups had championed Ames’ case, Ames v. Ohio Department of Youth Services, No. 23-1039. The Joe Biden administration also supported her argument, filing a brief supporting Ames.

Jackson’s opinion was tightly focused and nine pages long. Justice Clarence Thomas, joined by Justice Neil Gorsuch, issued a 14-page concurring opinion in which he mused about, among other things, the difficulty of defining identity in American society.

For instance, he wrote that it is not always easy to tell who is a member of the “majority.”

“Women, for example, make up the majority in the United States as a whole, but not in some states and counties,” Thomas wrote. “Similarly, women make up the majority of employees in certain industries, such as teaching and nursing, but the minority in other industries, such as construction.”

He added, quoting from the 2023 ruling rejecting race-conscious admissions, that “‘defining the majority’ is even more difficult in the context of race, as racial categories tend to be ‘overbroad’ and ‘imprecise in many ways.’ ”