The Supreme Court ruled unanimously Thursday that President Obama exceeded his constitutional authority in making high-level government appointments in 2012 when he declared the Senate to be in recess and unable to act on the nominations.

Obama made appointments to the National Labor Relations Board (NLRB) at a time when the Senate was holding pro forma sessions every three days precisely to thwart the president’s ability to exercise the power.

“The Senate is in session when it says it is,” Justice Stephen G. Breyer wrote for the court, stressing that if the Senate is able to conduct business, that is enough to keep the president from making recess appointments.

But the court stepped back from handing Obama — and those who will follow him in the Oval Office — a more substantial loss. A bare majority of the justices upheld, in theory at least, the president’s ability to make recess appointments when the Senate is indeed on extended break, saying history weighs in favor of a broad power.

The decision comes at a time when Republican opposition to the president’s policies and Obama’s vow to bypass a gridlocked Congress by using his executive powers have consumed Washington.

Although Breyer said the court hesitated to “upset the compromises and working arrangements that the elected branches of government themselves have reached,” it is the lack of such cooperation that brought the dispute to the court for the first time in the more than 200-year history of the Constitution.

The court’s decision did not seem to encourage the two sides to come together. Republicans said the decision vindicated their view that Obama oversteps his constitutional authority in all manner of policy decisions. “A unanimous Supreme Court,” said Senate Minority Leader Mitch McConnell (Ky.), has rejected Obama’s “brazen power grab.”

White House press secretary Josh Earnest said Obama would not hesitate to use his executive power in the remainder of his term. The administration was “deeply disappointed” with the court’s decision, Earnest said. “We are, however, pleased that the court recognized the president’s executive authority as exercised by presidents going all the way back to George Washington.”

As a practical matter, the decision means hundreds of decisions made by the NLRB are in legal limbo and may have to be taken up again, an agency spokesman said. Labor lawyers and others who do business with the board said the decisions are likely to be reaffirmed because it now has a majority of confirmed members nominated by Obama.

The justices employed Founding-era documents and the long history of recess appointments — there have been thousands of them — to interpret the Constitution’s Recess Clause. It says the president “shall have power to fill up all vacancies that may happen during the recess of the Senate.”

There was more riding on the outcome of the case before Senate Democrats changed the filibuster rules last year to make it easier for the president’s nominees to be confirmed on a majority vote. But the conflict could arise whenever one party controls the executive branch and the other the Senate.

It was the question of pro forma sessions that had prompted the case. Senate Democrats started such sessions in 2007 to prevent President George W. Bush from making recess appointments. Despite encouragement from his advisers to challenge the legitimacy of the sessions, he declined.

But when Obama became president and the membership of the NLRB fell to two members because Senate Republicans blocked votes on the president’s three nominees, Obama took action. Despite the pro forma sessions, he took note of the Senate’s declaration that no business would be conducted and made his nominees recess appointees.

A bottling company in Washington state that lost an NLRB ruling challenged the legitimacy of the members, and a panel of the U.S. Court of Appeals for the D.C. Circuit went beyond the question of pro forma sessions to greatly restrict the president’s power.

Judge David B. Sentelle said the Constitution’s reference to “the Recess” means that appointments are allowed only during the recess between sessions of the Senate, not when the Senate is simply on a break such as a summer recess.

Additionally, the panel said the president has the authority to make appointments only to vacancies that arise during a recess, which would significantly limit a president’s ability to use the recess appointment power.

Although the Supreme Court justices were unanimous on the specifics of the NLRB episode, they were sharply divided on bigger questions.

Breyer and the court’s liberals, joined by Justice Anthony M. Kennedy, read the Constitution to give wide authority to the president to make recess appointments when the Senate was on any break of 10 days or longer.

Breyer acknowledged that figure appears nowhere in the Constitution but said a review of past occasions when presidents made recess appointments showed that almost all occurred when the Senate was away for that long.

He said it did not matter whether the recess was within a session or between sessions.

Breyer also rejected a lower court’s decision that the president may fill only vacancies that occur during a recess.

“That broader reading is reinforced by centuries of history, which we are hesitant to disturb,” Breyer wrote. He and Kennedy were joined by Justices Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan.

Justice Antonin Scalia disagreed strongly, signaling his displeasure by reading from the bench a statement accusing his colleagues of “judicial adventurism.”

“This issue has been the subject of a long-simmering interbranch conflict that we ought to resolve according to our best lights, rather than by deferring to an overreaching Executive Branch,” he said.

He was joined by Chief Justice John G. Roberts Jr. and Justices Clarence Thomas and Samuel A. Alito Jr.

These justices would limit the president’s power to making appointments between sessions of Congress and only of those nominated to fill vacancies that occurred during the recess.

Scalia said that, as the current case showed, presidents have become enamored of the recess appointments because this relieves them of the more difficult task of persuading the Senate to give its “advice and consent,” as is constitutionally required.

The recess power is an “anachronism,” he wrote, from a time when the Senate was away for long periods of time and could not be easily convened for business.

“The need it was designed to fill no longer exists, and its only remaining use is the ignoble one of enabling the President to circumvent the Senate’s role in the appointment process,” he wrote.

Recess appointments — which can last no more than two years unless the Senate later confirms the nominee — became more popular after World War II, and presidents in both parties have made them. Two former members of the Supreme Court were recess appointments — including Chief Justice Earl Warren, who was later confirmed. Breyer pointed out that President Franklin D. Roosevelt commissioned Dwight D. Eisenhower as a permanent major general during a recess.

Miguel Estrada, who represented Senate Republicans in the case, called the ruling a victory for the Senate. “The Supreme Court reaffirmed the Senate’s power to prescribe its own rules, including the right to determine for itself when it is in session, and rejected the President’s completely unprecedented assertion of unilateral appointment power,” he said.

But Senate Majority Leader Harry M. Reid (D-Nev.) blamed Senate Republicans for denying nominees a chance to be confirmed through a vote of the full chamber. “President Obama did the right thing when he made these appointments on behalf of American workers,” Reid said in a statement.

According to the Congressional Research Service, Obama has made far fewer such appointments — 32 — than his predecessors. President George W. Bush made 171 over two terms, and President Bill Clinton made 139.

But none pushed the envelope the way Obama did, trying to make recess appointments when the Senate said it was in session.

In that way, the court’s decision essentially returns the situation to the way most believed recess appointments worked before Obama’s gambit.

But the rules spelled out by the decision may make it clearer for the Senate to design recesses in ways that further thwart the president’s power.

The case is National Labor Relations Board v. Noel Canning .