John McCain, who shed a playboy image in his youth to become a fighter pilot, revered prisoner of war and both an independent voice in the Republican Party and its 2008 presidential nominee, died on Saturday, little more than a year after he was told he had brain cancer. He was 81.

McCain’s office said in a statement that McCain died at 4:28 p.m. He announced on July 19, 2017, that he had been diagnosed with a glioblastoma, an aggressive type of brain tumor. On Friday, his family announced that he was discontinuing treatment.

"With the senator when he passed were his wife, Cindy, and their family. At his death, he had served the United States of America faithfully for 60 years," McCain's office said in the statement.

His daughter, Meghan McCain, said in a statement, "I was with my father at his end, as he was with me at my beginning."

"All that I am is thanks to him. Now that he is gone, the task of my lifetime is to live up to his example, his expectations, and his love,” she said.

I love you forever - my beloved father @SenJohnMcCain pic.twitter.com/Y50tVQvlVe — Meghan McCain (@MeghanMcCain) August 26, 2018

Cindy McCain tweeted: “My heart is broken. I am so lucky to have lived the adventure of loving this incredible man for 38 years. He passed the way he lived, on his own terms, surrounded by the people he loved.” She said he died in "the place he loved best."

In his 36 years in Congress, McCain became one of the country's most respected and influential politicians, challenging his fellow lawmakers to reach across the aisle for the good of the country, and often sparring with reporters with a biting if self-deprecating wit.

On a variety of issues — torture, immigration, campaign finance, the Iraq War — McCain was often known as the moral center of the Senate and of the Republican Party.

Last year, in his last act of defiance, McCain returned to the Capitol less than a week after his cancer was diagnosed to cast his vote on the Republican effort to repeal the Affordable Care Act — the biggest legislative achievement of President Barack Obama, the man who defeated him in the 2008 election.

McCain first voted in favor of debating the bill, giving his fellow Republicans hope that their long-sought goal of repealing Obamacare was in sight. McCain then dashed those hopes by casting the decisive vote against repeal.

Before the vote, McCain denounced the rise of partisanship in a heartfelt speech from the Senate floor on July 25, 2017.

"Why don’t we try the old way of legislating in the Senate, the way our rules and customs encourage us to act?" McCain said. "Merely preventing your political opponents from doing what they want isn’t the most inspiring work."

But in recent months, the man who had been a mainstay on Capitol Hill for more than three decades was noticeably absent.

He missed a White House ceremony on Dec. 12 in which President Donald Trump signed the annual defense bill into law — one of McCain's signature achievements.

A statement issued the following day by the senator's office said he was at the Walter Reed National Military Medical Center in Maryland receiving treatment for the "normal side effects of his ongoing cancer therapy" and looked forward to returning to work as soon as possible.

John McCain was a man of deep conviction and a patriot of the highest order. He was a public servant in the finest traditions of our country. President George W. Bush

McCain's life was punctuated by wild highs and lows, from the horrific conditions he endured for nearly 2,000 days as a prisoner of war to subsequent professional successes that brought him to the forefront of American politics.

Over the course of his career he rallied against pork-barrel spending and went against his own party's president, George W. Bush, on strategy for the Iraq war. He earned a reputation as a party maverick by advocating campaign finance reform, lending his name to the bipartisan McCain-Feingold Act of 2002, and supporting overhauling the nation's immigration system over the years

Bush said in a statement Saturday: "Some lives are so vivid, it is difficult to imagine them ended. Some voices are so vibrant, it is hard to think of them stilled. John McCain was a man of deep conviction and a patriot of the highest order. He was a public servant in the finest traditions of our country. And to me, he was a friend whom I'll deeply miss." He and Laura Bush expressed their condolences to the McCain family.