U.S. Sen. John McCain's parting public gesture is one worthy of a life devoted to public service and the nation he so loved: to have presidents of opposing parties, Republican George W. Bush and Democrat Barack Obama, deliver eulogies at his funeral. Both men had defeated him at critical junctures in his political life: Bush for the Republican presidential nomination in 2000, and Obama for the presidency in 2008.

It is a testament to McCain's character and purpose that even in death he sought to send a message about the value of placing a nation's unity and ideals before the corrosive tribalism that has taken hold of late.

In a way, McCain too was a proponent of America first, but an entirely different strain from that championed by President Donald Trump. McCain believed in country over self, in country over party. "To be connected to America's causes — liberty, equal justice, respect for the dignity of all people — brings happiness more sublime than life's fleeting pleasures," he wrote in a last letter to his country, made public on Monday.

McCain's brand of patriotism was honed while he lay broken in a Vietnamese prisoner-of-war camp. That experience would forever shape him, giving his life a meaning and purpose that would propel him through every challenge he faced. His was not the heroism of John Wayne movies. McCain candidly acknowledged that after turning down an early release by captors who wanted to make him a symbol of American weakness, he signed an anti-U. S. propaganda statement. It came after he'd been beaten around the clock by guards, when he was emaciated and still suffering from untreated broken limbs. "I had learned what we all learned over there," he would later say. "Every man has his breaking point. I had reached mine."

It was as a prisoner, he said, that "I fell in love with my country. I had loved her before then, but like most young people, my affection was little more than a simple appreciation for the comforts and privileges most Americans took for granted. It wasn't until I had lost America for a time that I realized how much I loved her."

That is a sentiment worth pondering at a time when so many Americans feel divided, doubtful of where their country is headed. What does it mean to love one's country? For McCain it was not unquestioning obedience to a leader, but a willingness to do whatever was necessary to preserve a nation's values. Shortly after learning of his deadly brain-cancer diagnosis, McCain made a dramatic return to the Senate floor in time to deliver one of its most historic moments — a thumbs-down on the repeal of the Affordable Care Act that ensured its defeat. In a floor speech, McCain exhorted his Senate colleagues to "learn to trust each other again. Stop listening to the bombastic loudmouths on the radio, television and internet. To hell with them. Let's trust each other … . We keep trying to find a way to win without help from across the aisle … . We're getting nothing done."

McCain would be the first to say he was not perfect. He was hot-­tempered, sometimes irascible. But he was unafraid to stand for what mattered. He did so famously in Minnesota, in his last quest for the presidency. Confronted by a woman at a 2008 town hall event who said she couldn't trust Obama because he was "an Arab," McCain immediately began shaking his head no. Gently taking the microphone from her, he declared his opponent to be "a decent family man, a citizen that I just happen to have disagreements with on fundamental issues, and that's what this campaign is all about."

McCain was a fighter all his life, whether it was the North Vietnamese, Democrats, members of his own party or the "bombastic loudmouths" he saw turning Americans against one another and fraying the fabric of the nation he loved.

In his last letter, he offers advice to a mourning nation that could also serve as an epitaph to an American hero:

"We weaken our greatness when we confuse our patriotism with tribal rivalries … when we hide behind walls rather than tear them down; when we doubt the power of our ideals rather than trust them to be the great force of change they have always been. If only we ... give each other the benefit of the presumption that we all love our country, we will get through these challenging times.

"Do not despair of our present difficulties but believe always in the promise and greatness of America, because nothing is inevitable here."