Washington: The Supreme Court on Tuesday limited the president's power to temporarily fill vacant government posts while nominations are tied up in partisan political fights.

The 6-2 ruling said a former top lawyer at the National Labor Relations Board had served in violation of a federal law governing such appointments.

Writing for the court, Chief Justice John Roberts said that Lafe Solomon was not allowed to serve as acting general counsel of the agency that enforces labor laws while he was at the same time nominated to fill that role permanently.

At issue is a 1998 law aimed at preventing the president from using temporary appointments to bypass the Senate's advice-and-consent role. The Federal Vacancies Reform Act says a person nominated for a post requiring Senate confirmation can't serve in the same position on a temporary basis.

But the law contains an exception if the nominee served for 90 days as a "first assistant" to the person who previously held the office. The Obama administration said the exception also covered Solomon because he had been a director at a different office at the NLRB.

President Barack Obama named Solomon acting general counsel in June 2010 and he held the office until Nov. 4, 2013. But he never won Senate confirmation because Republicans viewed him as too favorable to labor unions.

Roberts said a close reading of the law's text shows that the exception did not cover Solomon. He rejected the government's argument that a ruling against it would hamstring future presidents and call into question dozens of temporary appointments made over the years.

"This does not mean that the duties of general counsel to the NLRB needed to go unperformed," Roberts said. "The president could have appointed another person to serve as the acting officer in Solomon's place."

Solomon's authority was challenged after an Arizona-based ambulance company was accused of unfair labor practices. The company, SW General, Inc., said the complaint was void because Solomon's tenure was invalid.

The US Court of Appeals for the District of Columbia Circuit sided with the company.

Roberts dismissed arguments that historical practice supported the government. Since the law was enacted in 1998, three presidents have nominated 112 people for permanent posts who also were serving as acting officials. There was never any objection from Congress.

Roberts said those 112 nominations "make up less than two percent of the thousands of nomination to positions in executive agencies" that the Senate has considered during that time. He said the Senate either may not have noticed a problem or opted not to reject a candidate just to make a point about the law.

It's the second time in recent years that the presidential appointment process has come under scrutiny by the high court. In 2014, the Supreme Court ruled that Obama's recess appointment of three NLRB members violated the Constitution. That ruling invalidated hundreds of NLRB rulings and forced the agency to reissue those decisions.

Justices Sonia Sotomayor and Ruth Bader Ginsburg dissented, noting that the Senate never objected over the years while more than 100 people served in an acting capacity pending their nomination for a permanent post.