John McCain, whose wide-ranging independent streak sliced through an era of hardening partisanship and made him an indispensable senator for more than three decades, long before and well after his turn as the 2008 Republican presidential nominee, died Saturday.

He was 81 years old and had been diagnosed in July 2017 with glioblastoma, an aggressive brain cancer. His family announced on Aug. 24 that he had decided to stop treatment, saying “the progress of disease and the inexorable advance of age render their verdict. ”

But even during his final months in office, frailty did not keep him from playing his long-standing part as the Senate’s pivotal, hell-bent-for-leather iconoclast — self-deprecating and histrionic, bluntly combative and sounding impervious to the fray.

Eleven days after a malignant tumor was excised from his skull, McCain disregarded physicians’ advice back in his adopted home state of Arizona and returned to the Capitol for a career-climaxing stretch in which by turns he played Senate scold, partisan savior, policymaking spoiler and legislative dealmaker.

His first move was to excoriate colleagues in both parties for permitting partisan tribalism to eviscerate the legislative process. Then, he nonetheless provided the deciding vote that allowed senators to debate legislation repealing and replacing the 2010 health care law. Just 60 hours afterward, however, he stunned the capital with an after-midnight thumbs-down that proved the decisive vote denying Republicans their primary objective for the year.