Republican senator John McCain has chosen to discontinue medical treatment for his brain cancer, his family has said.
In a statement, the family said Mr McCain has surpassed expectations for survival, but "the progress of disease and the inexorable advance of age render their verdict".
The family added: "With his usual strength of will, he has now chosen to discontinue medical treatment."
The six-term Arizona senator and Republican presidential nominee from 2008 would be 82 next week. He has been away from the Capitol since December.
Mr McCain, a former Navy pilot, was held as a prisoner of war in Vietnam for more than five years.
He was elected to Congress in the early 1980s and was elected to the Senate in 1986. He gained a reputation as a lawmaker who was willing to stick to his convictions rather than go along with party leaders.
He has been a frequent target of criticism from President Donald Trump, especially for his vote against a Republican replacement for "Obamacare".
Senate majority leader Mitch McConnell said on Twitter that he was "very sad to hear this morning's update".
"We are so fortunate to call him our friend and colleague. John, Cindy and the entire McCain family are in our prayers at this incredibly difficult hour," Mr McConnell said.
Arizona governor Doug Ducey called Mr McCain "an American hero" who always put his country before himself.
Mr Ducey said a "spirit of service and civility" guided Mr McCain's life, standing as a model for Americans regardless of political affiliation.
Mr McCain's wife Cindy tweeted: "I love my husband with all of my heart. God bless everyone who has cared for my husband along this journey."
He underwent surgery in July 2017 to remove a blood clot in his brain after being diagnosed with an aggressive tumour called a glioblastoma.
Mr McCain rebounded quickly, returning to Washington and entering the Senate in late July to a standing ovation from colleagues.
In a dramatic turn, he later cast a deciding vote against the Republican health care bill, earning the wrath of Mr Trump, who frequently cites Mr McCain's vote at campaign events.
His condition worsened last autumn and he has been in Arizona since December.
A source close to Mr McCain who asked not to be identified said the senator is at his Arizona ranch with his family.
He is a long-term survivor of melanoma, a deadly skin cancer. Doctors classified his brain cancer as a primary tumour, meaning it is not related to his former malignancies.
He ran unsuccessfully for the Republican presidential nomination in 2000, then won it in 2008 before losing the general election to Mr Obama.
He returned to the Senate, determined not to be defined by a failed presidential campaign in which his reputation as a maverick had faded.
When Republicans took control of the Senate in 2015, Mr McCain, the scion in a decorated military family, embraced his new influence as chairman of the Senate Armed Services Committee, pushing for aggressive US military intervention overseas and eager to contribute to "defeating the forces of radical Islam that want to destroy America".
Asked how he wanted to be remembered, he said simply: "That I made a major contribution to the defence of the nation."