WASHINGTON — The Obama administration has urged the Supreme Court to strike down California’s voter-passed law barring same-sex marriage, arguing for the first time that the Constitution protects an equal right to marry for gays and lesbians.

“Tradition, no matter how long established, cannot by itself justify a discriminatory law,” the administration said in a brief filed with the high court late Thursday. “Prejudice may not be the basis for differential treatment under the law.”

The administration’s legal argument also would apply in at least seven other states that already have granted same-sex couples nearly all the rights of marriage through civil unions. To give those rights while withholding the status of marriage would amount to discrimination based on a person’s sexual orientation, and that cannot be justified under the Constitution, the brief says.

“The designation of marriage,” the brief notes, “conveys a message to society that domestic partnerships or civil unions cannot match.”

Presenting the argument in that manner struck a legal middle ground — giving the justices a way to overturn California’s Proposition 8 without upsetting the laws in all states that ban same-sex marriage. Gay rights advocates have asked the court to strike down all laws nationwide that bar same-sex couples from marrying, but many legal analysts have doubted that a majority of the justices would go that far.

The seven other states directly affected would be Delaware, Hawaii, Illinois, Nevada, New Jersey, Oregon and Rhode Island, the brief says.

In addition, the government argued, laws that discriminate based on sexual orientation should be treated skeptically by the courts, much as laws that discriminate by gender. That standard, if adopted, ultimately could invalidate other states’ laws against same-sex marriage.

The administration was not required to get involved in the California case, but the White House was heavily lobbied by gay rights groups that have orchestrated a series of briefs on their side by business leaders, prominent Republicans and other groups. Although the government’s brief did not go as far as gay rights advocates would have liked, it won immediate praise from those organizations.

Unlike most other outside groups, the views of the solicitor general’s office often have particular weight with the justices, although the court could decide the case on several other grounds.

The decision to file a brief, which came after several weeks of hesitation and internal debate, marks the latest step in President Obama’s self-described evolution on the issue of same-sex marriage. When he ran for president in 2008, he did not support marriage rights for gays and lesbians, although he also opposed Proposition 8, which California voters approved that year.

Last spring, as he was running for reelection, Obama said he supported gay marriage but believed the issue was a matter for the states to decide. At the time, some close to him suggested he would not weigh in officially on a constitutional right to marry.

But in January, gay rights activists took heart when, in his inaugural address, Obama compared their struggle to the civil rights and women’s movements.

“We, the people, declare today that the most evident of truths — that all of us are created equal — is the star that guides us still; just as it guided our forebears through Seneca Falls, and Selma, and Stonewall,” Obama said in that address, putting on the same plane key moments in fighting discrimination based on gender, race and sexual orientation.

Since then, Obama had appeared at times to be debating with himself. He referred to same-sex marriage as an issue of civil rights, but also told people in his inner circle that he thought social change was better when it took place through elections, not by court decree.

In conversations, he talked about the writings of civil rights leaders who had struggled with how and when to let courts drive societal change. On Wednesday, Obama seemed to be resolving that inner battle as he paid tribute to civil rights pioneer Rosa Parks at a ceremony in her honor.

“Whether out of inertia or selfishness, whether out of fear or a simple lack of moral imagination, we so often spend our lives as if in a fog, accepting injustice, rationalizing inequity, tolerating the intolerable,” he said.

“Rosa Parks tell us there’s always something we can do,” he went on. “She tells us that we all have responsibilities, to ourselves and to one another.”

In a statement Thursday, Atty. Gen. Eric H. Holder Jr. also put the marriage case in the context of the country’s civil rights tradition. “Throughout history, we have seen the unjust consequences of decisions and policies rooted in discrimination,” he said. “The issues before the Supreme Court are not just important to the tens of thousands of Americans who are being denied equal benefits and rights under our laws, but to our nation as a whole.”

Publicly, White House officials took pains to present the decision of whether to weigh in on the marriage case as one made at the Justice Department.

“The president obviously has expressed an opinion in the past on this issue as a matter of policy, but when it comes to legal and constitutional issues around it, that’s a jurisdiction that resides at the Department of Justice,” White House Press Secretary Jay Carney said.

Privately, however, senior administration officials made clear that on such a weighty policy issue, the government’s lawyers would wait for the president’s decision.

The case before the court will be the first to directly confront the justices with the question of whether the U.S. Constitution gives gays and lesbians a right to marry.

Judges in several states have upheld gay marriage under their state constitutions, and the California Supreme Court did the same in 2008. Proposition 8 overturned that ruling by changing the state constitution.

The case before the high court began shortly afterward when two same-sex couples sued in federal court in San Francisco, arguing that excluding them from marrying violated their rights to liberty and equal treatment.

A federal judge agreed and struck down Proposition 8. The U.S. 9th Circuit Court of Appeals upheld that decision, but did so on the narrower basis that the voters could not take marriage rights from gays and lesbians once those rights had been granted.

In December, the Supreme Court voted to hear an appeal from defenders of Proposition 8, who say the courts should defer to the wishes of the state’s voters.

California’s top officials, including Atty. Gen. Kamala Harris, have joined the case on the side of the gay plaintiffs. In a brief filed this week, Harris noted that more than 50,000 children in California are being raised by same-sex couples.

“California’s interests in protecting all of its children are best served by allowing these same-sex couples to enjoy the same benefits of marriage as opposite-sex couples,” Harris said.

The case will be argued before the court on March 26.

david.savage@latimes.com

christi.parsons@latimes.com