A unanimous Supreme Court on Monday overturned the bribery conviction of former Virginia Gov. Bob McDonnell in a ruling that could make it harder for prosecutors to bring corruption cases against elected officials.

McDonnell had been found guilty in 2014 of accepting more than $165,000 in gifts and loans from a wealthy businessman in exchange for promoting a dietary supplement. He was sentenced to two years in prison, but was allowed to remain free while the justices weighed his appeal.

The justices voted to narrow the scope of a law that bars public officials from taking gifts in exchange for "official action," saying it does not cover routine courtesies like setting up meetings or hosting events for constituents.

The high court took no position on whether prosecutors can try McDonnell again. The case now returns to lower courts to decide that question.

McDonnell said he never took any official action to benefit Star Scientific Inc. CEO Jonnie Williams or pressured other state officials to do so. McDonnell claims he did nothing in return except help a constituent gain access to other public figures.

Prosecutors insisted that McDonnell accepted personal benefits with the understanding he would try to take official action to help Williams.

Chief Justice John Roberts agreed with McDonnell that the jury instruction of "official acts" at his trial was so broad it could include virtually any action a public official might take while in office, leaving politicians across the country subject to the whims of prosecutors. Roberts said setting up a meeting, talking to another official or organizing an event does not -- without more evidence -- meet the definition of an official act under the law.

McDonnell had won the support of several influential former White House attorneys -- both Democrat and Republican -- as well as dozens of state attorneys general who told the court that upholding McDonnell's conviction would cripple the ability of elected officials to do their jobs.

There is no dispute that McDonnell received multiple payments and gifts from Williams, which was not illegal at the time under Virginia ethics laws.

The gifts included nearly $20,000 in designer clothing and accessories for McDonnell's wife, a $6,500 engraved Rolex watch, $15,000 in catering for their daughter's wedding, and free family vacations and golf trips for their boys. Williams also provided three loans totaling $120,000.

As the gifts came in, McDonnell helped set up meetings with state health officials, appeared at promotional events and even hosted a launch luncheon for the dietary supplement at the governor's mansion. Williams was seeking state money and the credibility of Virginia's universities to perform clinical research that would support his company's drug.

McDonnell insists that he never put any pressure on state officials and that Williams ultimately never got the official action he wanted -- state funding for medical studies on the dietary pills. The former governor argued the Justice Department was unfairly criminalizing "everyday acts" that are a typical part of job.

A federal appeals court unanimously upheld the former governor's convictions last year.

McDonnell's wife, Maureen, also was convicted of corruption and was sentenced to one year and one day in prison. Her appeal has been on hold while the Supreme Court considered her husband's case.