When Sen. John McCain returned to the Senate on Tuesday, and voted to reopen the health-care debate, he was cheered by Republicans. His return signaled to the GOP that they may have the votes needed to pass their health-care bill. But by the wee hours of the morning on Friday, when McCain voted against the GOP’s “skinny repeal” plan, the Republicans were no longer cheering. Instead, McCain was being embraced by Democrats and heralded as a hero on the left for bringing the GOP’s seven-year-long battle to repeal and replace Obamacare to a dramatic end.

This one short week, in which no one seemed to know whose side McCain was on, dramatized many major themes from his lengthy political career. He has been nicknamed “the Maverick,” while others see him as a staunch conservative. To many he is a hero, a true American patriot. He’s known for showing political courage and decency, but he has a famous temper. McCain’s long tenure in the political spotlight — he has been a member of Congress since 1983 and has run for president twice — means the public has had ample opportunity to form those varied opinions.

McCain’s office said in a statement Friday afternoon that he was returning to Arizona to undergo treatment for brain cancer. But the days before he left Washington were a reminder of why McCain is one of the more complex and interesting characters in the political landscape.

The conservative   

When McCain returned to the Senate on Tuesday and voted to reopen the health-care debate, President Trump thanked the Arizona senator, and congratulated Republicans for what he thought would be a victory in repealing Obamacare.

After all, despite being a vocal opponent of the president, McCain has voted with Trump 86.7 percent of the time, according to an analysis by FiveThirtyEight. 

The survivor 

McCain rose from his hospital bed after having a blood clot removed from behind his eye to return to the Senate. Just days after receiving a brain tumor diagnosis, he decided to delay treatment, because work beckoned. He walked into the Senate chamber on Tuesday, stitches still visible above his eye, and delivered an impassioned speech, calling on Republicans and Democrats not to repeat the mistakes of the past by passing a rushed health-care bill.

The week before his return, when news broke of his cancer diagnosis, many on the left and right took to Twitter to show support for the senator. Former president Barack Obama expressed his support in a tweet, calling McCain an American hero.

During the Vietnam War, McCain spent almost six years as a prisoner of war in North Vietnam after his plane was shot down during a mission over Hanoi. McCain recounted his perilous experience of being held prisoner for U.S. News & World Report after he returned home in 1973. The experience not only cemented him, in the eyes of the public, as a survivor and patriot, but it also sparked his desire to serve in the government.

“I had a lot of time to think over there, and came to the conclusion that one of the most important things in life — along with a man’s family,” he wrote, “is to make some contribution to his country.”

The moral compass

In the middle of all of the health-care chaos, after Trump tweeted that transgender people would be banned from serving in the military, McCain issued a statement questioning Trump’s position and reaffirming the Department of Defense’s earlier decision to allow transgender people to serve.

“Any American who meets current medical and readiness standards should be allowed to continue serving. There is no reason to force service members who are able to fight, train and deploy to leave the military — regardless of their gender identity,” he wrote in a statement. The statement was not all-out support for transgender people in the military. Instead, McCain argued that no new decision should be made until after the Department of Defense concludes its study to assess the medical obligations it would incur in support of transgender people serving.

Lightning rod for the left 

Many on the left lamented McCain’s return, assuming, like Trump, that McCain would deliver the final vote needed to secure a win for the GOP. Protesters gathered on the steps of the Capitol last week, joined by Democratic senators such as Senate Minority Leader Charles E. Schumer.

“We are going to fight and fight and fight until this bill is dead!” said Schumer.

Andy Slavitt, the former acting administrator of the Centers for Medicaid and Medicare under the Obama administration, poised for sure defeat, chided McCain on Twitter:

The maverick

And in the end, McCain surprised both the left and the right. After several days of uncertainty, Twitter attacks and threats, the political process ended with McCain showing the independent streak he has prided himself on throughout his career, and backing up what he said in his speech Tuesday.

“Incremental progress, compromises that each side criticize but also accept, just plain muddling through to chip away at problems and keep our enemies from doing their worst, isn’t glamorous or exciting. It doesn’t feel like a political triumph. But it’s usually the most we can expect from our system of government, operating in a country as diverse and quarrelsome and free as ours. Considering the injustice and cruelties inflicted by autocratic governments and how corruptible human nature can be, the problem solving our system produced and the liberty and justice it preserves is a magnificent achievement.”