The U.S. Supreme Court on Thursday may have virtually handed President Barack Obama a second term in the White House after it upheld a core provision of his landmark healthcare reform policy, the individual mandate requiring every American to purchase insurance or face a penalty.

In a legally dense, 110-page ruling, the Court said that the argument that the individual mandate should be upheld under the U.S. constitution’s commerce clause was not valid. However in a 5-4 split decision the Justices argued that the individual mandate could be allowed to stand as a tax.

Supporters and critics of the law thronging outside the Supreme Court’s premises in Washington and an entire nation holding its breath appeared to be caught off-guard by the decision itself. Sharp queries from the Justices during the early hearings in the case appeared to indicate their scepticism about the mandate.

Yet in the narrow victory for the White House the surprise swing vote came from conservative Chief Justice John Roberts, who sided with the majority of liberal justices including Ruth Bader Ginsburg, Stephen Breyer, Sonia Sotomayor and Elena Kagan. The dissenting Justices were Antonin Scalia, Anthony Kennedy, Clarence Thomas and Samuel Alito.

Welcoming the verdict Mr. Obama said, “The highest Court in the land has now spoken. We will continue to implement this law... But what we won’t do... is re-fight the political battles of two years ago, or go back to the way things were.”

In supporting the mandate, the Court has in effect upheld the entirety of the Affordable Healthcare Act, a bitterly contested law on which Mr. Obama staked much of his credentials in the early years of his presidency. However the Court set some limits to the law’s proposed expansion of the Medicaid programme for the poor, allowing individual states to opt out.

Mitt Romney, Mr. Obama’s Republican rival in the November presidential elections, issued a muted statement after the verdict, where he said that the Supreme Court had ruled that “Obamacare” as it is pejoratively referred to by conservatives, is constitutional, but it was still “bad law.”

More In: International | News