Tributes from former US presidents and across the political spectrum have poured in for Republican Senator John McCain, who has died aged 81.
Barack Obama, who beat him to the White House in 2008, said they had shared a “fidelity to something higher”.
George W Bush described him as “a patriot of the highest order”.
President Donald Trump, whom McCain had strongly criticised, tweeted his “deepest sympathies” to McCain’s family but did not comment on his life.
By contrast, First Lady Melania Trump thanked the late senator for his “service to the nation”.
Sources quoted by US media said Mr Trump would not be invited to the funeral and the current administration would probably be represented by Vice President Mike Pence.
Former Presidents Obama and George W Bush are expected to give eulogies.
McCain was diagnosed with an aggressive brain tumour in July last year and had been undergoing treatment.
But on Friday his family announced he had decided to discontinue that treatment.
A statement from his office on Saturday said McCain had died in Arizona surrounded by family members.
His family said he would lie in state in Phoenix, Arizona, and in Washington DC before a funeral at the Washington National Cathedral and his burial in Annapolis, Maryland.
How is he being remembered?
“He was a public servant in the finest traditions of our country,” Mr Bush said. “And to me, he was a friend whom I’ll deeply miss.”
Mr Obama said that despite being his Democratic rival, they had shared the ideals “for which generations of Americans and immigrants alike have fought, marched and sacrificed”.
Sarah Palin, who was McCain’s running mate during his 2008 presidential bid, said the world had lost “an American original”.
From outside the US, Israeli Prime Minister Benjamin Netanyahu hailed McCain as “a great American patriot” whose “support for Israel never wavered.”
Canadian Prime Minister Justin Trudeau said McCain’s lifetime of public service had been an “inspiration to millions”.
As a hearse brought Mr McCain’s body from his ranch in Sedona, Arizona, to a funeral home in Phoenix, people waving flags lined the street.
Who was John McCain?
The son and grandson of Navy admirals, he was a bomber pilot during the war in Vietnam. When his plane was shot down, he spent more than five years as a prisoner-of-war.
While being held by his captors, he suffered torture that left him with lasting disabilities.
In politics, he took a conservative line on many issues, opposing abortion and advocating higher defence spending.
He backed the 2003 invasion of Iraq and criticised President Obama for not intervening more in the Syrian civil war.
However, he also gained a reputation as a Republican maverick who was willing to cross party lines on a range of issues.
In July last year, just after his diagnosis, he took part in a late-night Senate session and gave the deciding vote – with a thumbs-down gesture – against partially repealing the contentious Obamacare healthcare law. The move reportedly infuriated Mr Trump.
McCain also criticised President Trump’s hard-line rhetoric on illegal immigration and his attacks on the media.
A fighter to the very end
By Anthony Zurcher, BBC North America reporter
John McCain was born shortly before World War II, at the dawn of the “American Century” – a time when the US was at the peak of its political, military and cultural power. He dies at what could be considered that age’s twilight, as the nation turns inward and contemplates walls, literal and metaphorical, to insulate itself from the rest of this world.
The life of the senator from Arizona marked the arc of this journey.
He suffered, as the nation suffered, from the morass of Vietnam.
As a young politician he was tempted by the lure of power and money, caught up in an influence-peddling scandal that nearly cost him his career.
In his first run for president in 2000, he capitalised on an anti-establishment sentiment and longing for authenticity that would later come to crest with Donald Trump’s election. In 2008, he won the Republican nomination, only to see his hopes dashed by the phenomenon that was Barack Obama and a crumbling US economy.
McCain never won the top political office for which he longed. Throughout his life, however, he offered a full-throated defence of an America that was active and engaged in the world. In his final years he sparred with Mr Trump over the direction of the Republican Party and the principles it should embrace.
It’s an open question as to whether these views have a future in his party. McCain, however, fought for what he believed was right until the very end. Agree with him or not, that is undeniably a most appropriate epitaph.