When the Supreme Court convened in 1967 to decide the case of Loving vs. Virginia, 16 Southern states had made it a crime for interracial couples to marry. The trial judge who convicted Richard and Mildred Loving said such laws reflected divine will.
"Almighty God created the races white, black, yellow, malay and red, and he placed them on separate continents," the judge said. "The fact that he separated the races shows that he did not intend for the races to mix."
Then-Chief Justice Earl Warren quoted those words before declaring laws banning interracial marriages unconstitutional. "The freedom to marry" is one of "the basic civil rights" and a "fundamental freedom," he said. "The principle of equality at the heart of the 14th Amendment" does not permit a state to deny marriage to a couple because of race.
Nearly half a century later, Justice Anthony M. Kennedy, who as a boy in Sacramento knew Warren, quoted the former chief justice Friday in his own landmark decision striking down state laws that forbid marriage between same-sex couples. The "right to marry" is a fundamental freedom, Kennedy said.
Only the barest majority on the court agreed, however. The case was decided 5 to 4, and Kennedy's opinion drew a stinging retort from the current chief justice, who accused the court of "stealing this issue from the people."
"Just who do we think we are?" John G. Roberts Jr. demanded.
Roberts' charge highlighted one of the most difficult questions confronting the nine justices: In a time of changing social attitudes, when should they step in to alter or overturn laws approved by voters or other elected branches of government?
The issue has repeatedly divided the high court in recent years, with justices landing on both sides of the question, arguing for judicial restraint in some cases and for intervention in others.
Two years ago, the same conservative justices who accused Kennedy and their liberal colleagues of activism in the same-sex marriage decision joined with Kennedy to strike down part of the 1965 Voting Rights Act, even though the measure had been approved and extended with nearly unanimous support in the House and Senate.
Key provisions of the law required Southern states and cities with a history of discriminating against black voters to get clearance from the federal government before changing their election rules.
But in Shelby County, Ala., vs. Holder, Roberts said the continued enforcement of the Voting Rights Act was demeaning to Southern states and violated "the fundamental principle of equal sovereignty among the states," a phrase that does not appear in the Constitution.
The four liberal justices, in dissent, expressed a version of the chief justice's complaint on Friday: Just who do you think you are?
The same divide was apparent in 2010 when the court decided a challenge to restrictions on campaign spending.
Congress since 1907 had barred corporations from putting their money into election campaigns, and for much of the 20th century, few people argued that this violated the 1st Amendment's free-speech protections.
But in a 5-4 opinion in the Citizens United decision, Kennedy, Roberts and the three conservative justices ruled these bans were unconstitutional. The four dissenting liberals had called for restraint.
Kennedy cast the crucial vote in all these cases.
He has been most willing to read constitutional rights broadly, joining the conservatives to strike down campaign spending bans on free-speech grounds, and joining the liberals to rule that gays and lesbians are entitled to equal rights and liberties.
But Kennedy has been sensitive to the slow pace of changing public attitudes, as justices have been for decades.
A year after the Warren court in 1954 struck down racial segregation in schools, the justices pointedly refused to hear a challenge to the laws against interracial marriage. Some justices worried it would further inflame public opinion in the South.
In the next decade, about a dozen states in other parts of the nation repealed their bans or saw them struck down by state courts. But by 1967, when the court decided Loving, it was clear the Southern states would not repeal their "racial integrity" laws.
A similar evolution appeared underway with state laws forbidding same-sex marriage, though fewer than a dozen states had actually enacted legislation permitting such marriages.
In 2003, Kennedy wrote a powerful opinion that struck down the last remaining laws that criminalized gay sex. But he stopped short of saying gays had a right to marry.
A few months later, the Massachusetts high court became the first to uphold same-sex marriage.
The tide of public opinion began to turn. By 2013, when the Supreme Court took up a challenge to the federal Defense of Marriage Act, about half of the Americans surveyed said they supported same-sex marriage. Again, Kennedy spoke for a 5-4 majority to strike down the federal ban on benefits for same-sex couples, but he did not say there was a constitutional right to marry.
When the issue returned this spring, judges across the country had struck down bans on same-sex marriage, and more than 60% of the public voiced support.
Yet while Warren's court ultimately ruled unanimously to end bans on interracial marriage, this court remains closely divided. Along with Roberts, Justices Antonin Scalia, Clarence Thomas and Samuel A. Alito Jr. said the court had no business deciding the issue.
The question is "not about whether, in my judgment, the institution of marriage should be changed to include same-sex couples. It is instead about whether, in our democratic republic, that decision should rest with the people acting through their elected representatives, or with the five lawyers" who serve on the high court, Roberts said.
Kennedy, speaking for the majority, said gays and lesbians had waited long enough.
Some had waited as their lifelong partners took sick, lingered and died, never having gained the full recognition of marriage, he wrote. Many others were raising children, but were denied their full rights as parents under the law.
It would be wrong to contend these men and women "disrespect the idea of marriage," Kennedy wrote. "Their plea is that they do respect it, respect it so deeply that they seek to find its fulfillment for themselves.... They ask for equal dignity in the eyes of the law. The Constitution grants them that right."