U.S. Republican Senator John McCain, 81, the conservative party's 2008 presidential nominee, died late Saturday, 13 months after revealing he was suffering brain cancer, his office announced.
McCain was known to the end as a pugnacious maverick, last month offering blistering criticism of President Donald Trump's failure to stand up to Russian President Vladimir Putin.
"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 sixty years," his office said in a statement.
McCain had halted treatment Friday for aggressive glioblastoma, which was diagnosed in July 2017.
The retired Navy fighter pilot, who was shot down over North Vietnam in 1967 and held as a prisoner of war for more than five years, entered Congress in 1983 from Arizona and has served in the Senate since 1987.
Days after undergoing brain surgery in Arizona, with open stitches above his left brow, McCain appeared on the Senate floor in late July 2017, delivering a speech against partisanship and eventually casting the deciding vote against a major health care measure supported by Trump.
The hawkish chairman of the Senate Armed Services committee was a top Republican voice on defense and foreign policy for decades.
He mounted losing presidential campaigns in 2000 and 2008.
McCain has been a leading Republican dissident since Trump took office in January 2017.
After Trump failed to publicly confront Russian President Vladimir Putin about election meddling, McCain called their Helsinki summit in July "one of the most disgraceful performances by an American president in memory."
Trump, who was silent since the McCain family's announcement about stopping treatment made it clear that the end was near, tweeted condolences late Saturday.
"My deepest sympathies and respect go out to the family of Senator John McCain," Trump wrote on Twitter. "Our hearts and prayers are with you!"
Former president Barack Obama said that he and his 2008 election rival "were members of different generations, came from completely different backgrounds, and competed at the highest level of politics. But we shared, for all our differences, a fidelity to something higher - the ideals for which generations of Americans and immigrants alike have fought, marched, and sacrificed."
McCain shared the view of the United States as "a place where anything is possible - and citizenship as our patriotic obligation to ensure it forever remains that way."
Obama said that he and his wife, Michelle, offered "our most heartfelt condolences" to the McCain family.
"Few of us have been tested the way John once was, or required to show the kind of courage that he did. But all of us can aspire to the courage to put the greater good above our own," Obama said.
McCain's 2008 vice presidential running mate, former Alaska governor Sarah Palin, remembered him as "an American original."
"John never took the easy path in life - and through sacrifice and suffering he inspired others to serve something greater than self," she tweeted.
South Carolina Senator Lindsey Graham, a fellow military officer, tweeted that McCain was "one of my dearest friends and mentor."
"America and Freedom have lost one of her greatest champions," the Republican Graham wrote on Twitter.
Democratic National Committee chairman Tom Perez said that McCain "always will be an American hero."
Paul Ryan, Republican speaker of the House of Representatives, said that Congress and the country will mourn with the McCain family.
"John McCain was a giant of our time - not just for the things he achieved, but for who he was and what he fought for all his life," he said.
McCain's daughter, television host Meghan McCain said that she and other family members were with her father when he died.
"I take comfort in this: John McCain, hero of the republic and to his girl, wakes today to something more glorious than anything on this earth," she said in a statement on social media.
The son and grandson of Navy admirals, McCain is a former Navy pilot and was held as a prisoner of war in Vietnam for more than five years. He was elected to Congress in the early 1980s and elected to the Senate in 1986, replacing Barry Goldwater who retired. McCain gained a reputation as a lawmaker who was willing to stick to his convictions rather than go along with party leaders. It is a streak that draws a mix of respect and ire.