WASHINGTON (AP) — The Supreme Court on Thursday limited the president’s power to fill high-level vacancies with temporary appointments, ruling in favor of Senate Republicans in their partisan clash with President Barack Obama.

The high court’s first-ever case involving the Constitution’s recess appointments clause ended in a unanimous decision holding that Obama’s appointments to the National Labor Relations Board in 2012 without Senate confirmation were illegal. Obama invoked the Constitution’s provision giving the president the power to make temporary appointments when the Senate is in recess.

Problem is, the court said, the Senate was not actually in a formal recess when Obama acted.

Obama had argued that the Senate was on an extended holiday break and that the brief sessions it held every three days were a sham that was intended to prevent him from filling seats on the NLRB.

The justices rejected that argument Wednesday.

Justice Stephen Breyer said in his majority opinion that a congressional break has to last at least 10 days to be considered a recess under the Constitution.

The issue of recess appointments receded in importance after the Senate’s Democratic majority changed the rules to make it harder for Republicans to block confirmation of most Obama appointees.

But the ruling’s impact may be keenly felt by the White House next year if Republicans capture control of the Senate in the November election. The potential importance of the ruling lies in the Senate’s ability to block the confirmation of judges and the leaders of independent agencies like the NLRB. A federal law gives the president the power to appoint acting heads of Cabinet-level departments to keep the government running.

Still, the outcome was the least significant loss possible for the administration. The justices, by a 5-4 vote, rejected a sweeping lower court ruling against the administration that would have made it virtually impossible for any future president to make recess appointments.

The lower court held that the only recess recognized by the Constitution is the once-a-year break between sessions of Congress. It also said that only vacancies that arise in that recess could be filled. So the high court has left open the possibility that a president, with a compliant Congress, could make recess appointments in the future.

A recess appointment can last no more than two years. Recess appointees who subsequently won Senate confirmation include Chief Justice Earl Warren and Justice William Brennan, Federal Reserve Chairman Alan Greenspan, two current NLRB members and Consumer Financial Protection Bureau director Richard Cordray. Former UN Ambassador John Bolton is among recess appointees who left office because they could not win a Senate vote.

The issue of recess appointments receded in importance after the Senate’s Democratic majority changed the rules to make it harder for Republicans to block confirmation of most Obama appointees.

But the ruling’s impact may be keenly felt by the White House next year if Republicans capture control of the Senate in the November election. The potential importance of the ruling lies in the Senate’s ability to block the confirmation of judges and the leaders of independent agencies like the NLRB. A federal law gives the president the power to appoint acting heads of Cabinet-level departments to keep the government running.

Still, the outcome was the least significant loss possible for the administration. The justices, by a 5-4 vote, rejected a sweeping lower court ruling against the administration that would have made it virtually impossible for any future president to make recess appointments.

The lower court held that the only recess recognized by the Constitution is the once-a-year break between sessions of Congress. It also said that only vacancies that arise in that recess could be filled. So the high court has left open the possibility that a president, with a compliant Congress, could make recess appointments in the future.

A recess appointment can last no more than two years. Recess appointees who subsequently won Senate confirmation include Chief Justice Earl Warren and Justice William Brennan, Federal Reserve Chairman Alan Greenspan, two current NLRB members and Consumer Financial Protection Bureau director Richard Cordray. Former UN Ambassador John Bolton is among recess appointees who left office because they could not win a Senate vote.

The Supreme Court has limited a president’s power to make temporary appointments to fill high-level government jobs.

The court said Thursday that President Barack Obama exceeded his authority when he invoked the Constitution’s provision on recess appointments to fill slots on the National Labor Relations Board in 2012.

The justices said in their first-ever consideration of the Constitution’s recess appointments clause that Congress gets to decide when it is in recess and that there was no recess when Obama acted. The president said he made the appointments in the face of Republican refusal to allow the NLRB to function.