The Supreme Court upheld President Obama’s signature healthcare law Thursday in a 5-4 decision that vindicates Obama and helps define Chief Justice John Roberts.

The court said the health law’s individual mandate, which requires most taxpayers to either buy insurance or pay a penalty, is a tax and is constitutional. The court also altered the law’s Medicaid expansion without striking it down entirely.

The ruling is an enormous victory for President Obama and congressional Democrats, who had long insisted the healthcare law is constitutional.