The death of Sen. John McCain marks the passing of a man, an American patriot and a politician whose record of service to country will always be his defining attribute. His death also punctuates the passing of an era of American politics, one that in these troubled times seems almost irretrievable. McCain would not want to hear that, but he would know it to be true.

The accolades for the Arizona senator that poured forth in a torrent of admiration and respect in the hours after his death are deserved. The words vary from one statement to another but they all sound the same note. John McCain was a heroic figure who put country first, ahead of party, ahead of everything else. Not a perfect man, as he was often the first to say, but someone whose very flaws made him a more authentic and effective advocate for the causes he pursued.

He was born and bred to serve, the son and grandson of Navy admirals, and he did so with courage and conviction, sometimes with grit and anger, almost always with humor and affection for those who joined him in the battles. As a prisoner of war in North Vietnam, he refused to abandon his fellow POWs when he was offered the chance. It was not in his character to do so, and throughout his life he always refused to abandon the causes in which he believed, even at times when he was a lonely voice.

The Vietnam prison camp was a brutal and dehumanizing experience that left him physically broken for the rest of his life. Yet even in pain, he operated with remarkable energy, constantly on the move, never looking back, always eager for the next fight. He used straight talk and sarcasm to maintain his buoyancy and to disarm others. He was called a maverick for a reason, but that seemed a cramped and narrow definition of who he was. He preached that people should serve a cause greater than self, and lived what he preached. He was more than a maverick by a mile.

He suffered setbacks and bounced back. In the late 1980s, he was swept up in the scandal known as the Keating Five, an influence-peddling episode for which he ultimately was exonerated. The experience shattered him for a time. He was humiliated to have been the subject of a Senate ethics investigation. He would later call it “my asterisk.”

He lost the 2000 Republican nomination to then-Texas Gov. George W. Bush after a vicious primary campaign in South Carolina that burned into his consciousness and sent him scrambling to find himself and the man he believed he was.

After his campaign ended, he made a pilgrimage back to South Carolina to say he regretted that he had not stood strongly with those calling for the Confederate flag to be removed from the state capitol. He had fudged during the campaign, an instance when he was nothing more than a conventional politician shaving his convictions in pursuit of a gold ring. His statement of regret still stands as a remarkable document.

With Bush in the White House, McCain, with then-Sen. Russ Feingold (D-Wis.), forced through Congress a campaign-finance reform bill opposed by many of his GOP colleagues and by the president himself. McCain didn’t care. It was the cause that had carried him through the campaign itself. The bill hardly solved the problem of big money in politics, but it was a start at dealing with something that mightily offended McCain’s sensibilities, which was the flagrant pursuit of ever-bigger contributions from the wealthiest Americans.

He lost the presidency in 2008 to then-Sen. Barack Obama. One part of McCain’s legacy will be his selection of Sarah Palin, then the governor of Alaska, as his running mate. It was a political decision made out of desperation. He would rather have picked his friend Joe Lieberman, the one-time Democrat turned independent. McCain succumbed to those who said Palin was a better choice.

That he even was in a position to pick a running mate was astonishing. In the summer of 2007, his campaign imploded over conservative reaction to his push for immigration reform, which crippled his fundraising and caused a massive staff exodus. Through sheer determination, he forced himself to keep going when others had given up on him and allies had left him.

Early in that campaign, he staked out a singular position in support of Bush’s Iraq War surge, at a time when all political wisdom called for him, like others, to push in the other direction, to call for an end to the war on some kind of timetable. Some called Bush’s policy to send more troops to Iraq at a time of growing opposition to the war the McCain Doctrine. It was not meant kindly. Did he accept that characterization, he was asked at the time?

“No,” he replied. “But I am willing to accept it as a McCain principle. That is when I sign up, when I raise my hand and vote to go to war, that I want to see the completion of the mission.”

He chose his battles, picked his fights and then found allies wherever he could, whether in his own party or the other party. He thrived on cross-partisan cooperation, when it was possible. He was part of the Gang of 14 that headed off a Senate crisis over judicial nominations. He was part of the Gang of Eight that produced a comprehensive immigration bill that passed the Senate and then hit a wall in the House.

He worked with Sen. Edward M. Kennedy (D-Mass.). Their politics differed but they shared a belief in compromise as the path to progress and a love for the institution of the Senate. McCain’s death came exactly nine years after Kennedy’s. For both, the cause of death was brain cancer.

McCain’s style was what has now become known as authenticity and transparency. He wore his convictions, his beliefs, his disappointments, his anger, his ebullience openly. He was not afraid of reporters; in his 2000 campaign, aboard the bus he called the Straight Talk Express, he wore out the traveling press with rolling news conferences that seemed to last indefinitely. In those days, he called the press, jokingly, “my base.” Such was the friendliness of the coverage.

Later, against Obama, McCain felt the sting of coverage that was far less gentle, that was more favorable to the Democratic nominee than to himself. He could not hide his dissatisfaction. But it was the beginning of a different era, of social media and the like, changes that robbed him of some of the spontaneity that had marked his personality.

For the past three years, McCain was one of President Trump’s fiercest critics. But in ways different from how Trump belittled McCain as “not a hero” for having been shot down in Vietnam. McCain’s criticisms were grounded in policy and conflicting worldviews, especially on Russia and Vladimir Putin. To Trump’s America First message, McCain countered with what he always pursued: Country First. There is a big difference.

In one of his final acts, he turned against the president and his own party to sink the bill that would have repealed and replaced the Affordable Care Act. That moment last year, theatrical in its unfolding, devastating for what it did to the Republican Party and the president, stands as a reminder of the man and the time in which he long served.

McCain rarely wavered in the way he conducted himself and his politics, even to the end. But times change. He was asked once whether anyone could replicate the Straight Talk Express in the age of Twitter and round-the-clock news cycles. No, he said with some sadness in his voice, it was no longer possible. His death is a reminder not only of the loss of a giant in American politics, but of a new time, with new challenges for the generation that now must follow in his footsteps. Will anyone pick up the legacy he leaves behind?