The Supreme Court handed down major victories for gay marriage. The Post’s Robert Barnes breaks down the DOMA and Proposition 8 decisions from the courthouse steps. (The Fold/The Washington Post)

An extraordinary finale to a history-making term once again revealed the Supreme Court to be Washington’s most unpredictable institution.

Or at least that’s how it must appear.

One day’s decision left essentially untouched the court’s controversial permission to let race play some role in college admissions. It was followed the next day by a decision overruling Congress and striking down the heart of the Voting Rights Act, which has protected minority voters for nearly half a century.

A year ago, a conservative court frequently at odds with President Obama and his administration ended its term by saving the president’s signature domestic achievement, the Affordable Care Act.

The follow-up this term was again a victory for the president on his most pressing item before the court: gay rights.

And so another term ended with surprising praise from the president.

At a news conference in Africa, Obama on Thursday declared the court’s 5 to 4 decision striking down the 1996 Defense of Marriage Act a “victory for American democracy.”

“I believe at the root of who we are as a people, who we are as Americans is the basic precept that we are all equal under the law,” Obama said. “We believe in basic fairness. And what I think yesterday’s ruling signifies is one more step towards ensuring that those basic principles apply to everybody.”

Said Pamela Harris, former head of the Georgetown Law Center’s Supreme Court Institute and a onetime Obama White House lawyer: “If you weren’t paying close attention, you might say, ‘What a liberal Supreme Court we have.’ ”

Roles on the bench

Instead, it is a court in which two men — Chief Justice John G. Roberts Jr. and Justice Anthony M. Kennedy — play outsize roles. They are the keys to understanding the court’s sometimes contradictory messages, and that will likely be the case so long as they serve together.

Their influence changes with the cases that arise each term for the court.

This year was Kennedy’s term, partly because he is more moderate than his colleagues on both the left and the right, but also because he holds “a combination of views that are idiosyncratic,” said Richard Garnett, a Notre Dame law professor.

The Supreme Court’s 2012-2013 term made history by striking down key elements of the Voting Rights Act and the Defense of Marriage Act, both in 5 to 4 decisions. See how agreement on the court breaks down in this interactive graphic.

They include a strong belief in state’s rights, an aversion to racial classifications and a somewhat libertarian view on issues of privacy, Garnett said. Kennedy has written the court’s most important gay rights decisions. That jurisprudence fit perfectly with the civil rights cases that ended up this year on the court’s docket.

In the three major cases that ended the court’s term — affirmative action in higher education, the Voting Rights Act and the Defense of Marriage Act — Kennedy was the only justice in the majority each time.

It’s a role he is eager to play.

“Justice Kennedy believes the court is the exclusive arbitrator of the Constitution,” said Walter Dellinger, a lawyer who served in the solicitor general’s office.

A line in Kennedy’s majority opinion in the DOMA case, saying the court must decide the case because of its “primary role in determining the constitutionality of a law,” drew scorn from a dissenting Justice Antonin Scalia.

“It is an assertion of judicial supremacy over the people’s Representatives in Congress and the Executive,” Scalia wrote. “It envisions a Supreme Court standing (or rather enthroned) at the apex of government, empowered to decide all constitutional questions, always and everywhere ‘primary’ in its role.”

Such concerns rang hollow to the court’s liberals, who were on the losing side in the voting rights case. They said that Kennedy and the right trampled over the 15th Amendment’s command that Congress pass laws protecting minority voting rights, and that the court should defer to that judgment.

“Where is the court’s usual restraint?” asked Justice Ruth Bader Ginsburg.

Roberts’s function

But that is where Roberts played a key role, one that he seemed to have set up earlier in his tenure.

Racial classifications, increasingly unpopular with the public, are an enemy that Roberts and Kennedy share. Kennedy, who joined the court in 1988, has long held that view, and Roberts fought the practice as a young lawyer in the Reagan White House. In his first term on the court, in a case about minority voting districts, he denounced “this sordid business, divvying us up by race.”

He has similarly been critical of the way the Voting Rights Act singled out some states for special oversight. “Is it the government’s submission that the citizens in the South are more racist than citizens in the North?” he asked Solicitor General Donald B. Verrilli Jr. during oral arguments in the challenge brought by Shelby County, Ala. But he has also been willing to bide his time.

In a case from 2009, he wrote that the court had serious questions about the formula used by Congress to decide which states should be subject to special oversight. When nothing was done, he used the Shelby County case to strike down the formula, effectively ending the oversight and saying Congress had left the court “no choice.”

The on-the-one-hand, on-the-other-hand decisions on minority rights and same-sex marriage might strike the public as balancing. Polls show the public has a generally favorable opinion of the court. Although a majority of the justices were appointed by Republican presidents, polls show Democrats actually have a higher opinion of it.

And some of the court’s alignments on less-noticed cases defy classifications. Several times this term Scalia teamed with the liberals on criminal procedure issues, for instance.

Steven R. Shapiro, legal director of the American Civil Liberties Union, has been frank in the past about wanting to keep some issues that his organization cares about away from Supreme Court review.

But this year, his group prevailed in four of the six cases in which it participated. “It is a complex institution dealing with complex issues,” he said.

Eric Posner, a law professor at the University of Chicago, said it will not be good for the court if the term is remembered for the Voting Rights Act and DOMA decisions, both of which he found poorly reasoned. When the court appears to be striking down legislation with which it simply disagrees, he said, “that can create a backlash.”