Sen. John McCain is discontinuing medical treatment, his family announced Friday, just more than a year after the maverick Republican from Arizona was diagnosed with brain cancer.

Their statement said McCain, who turns 82 this week, had surpassed expectations for his survival since his diagnosis last July of glioblastoma, a terminal form of brain cancer.

“But the progress of disease and the inexorable advance of age render their verdict” and the senator has decided to end medical treatment, the statement said.

McCain, a celebrated Navy pilot in the Vietnam War, has been absent from Washington since last December. While undergoing treatment in Arizona, he has kept a low profile, issuing written statements on major news developments but offering the public few glimpses of his condition.

As of Friday, McCain’s family and close friends had gathered with him at his family ranch near Sedona, north of Phoenix. His daughter Meghan McCain, a co-host of ABC’s “The View,” announced last week that she would spend the next several weeks at home with her family.

“I love my husband with all of my heart,” Cindy McCain wrote Friday on Twitter shortly after the family statement was released. “God bless everyone who has cared for my husband along this journey.”

In a separate tweet, Meghan McCain thanked the country for support and prayers over the past year.

“We could not have made it this far without you — you’ve given us strength to carry on,” she said.

During a long and sometimes polarizing political career, McCain has served in the Senate for more than three decades and twice sought the presidency.

Friday’s news prompted an immediate outpouring of support on social media and elsewhere from McCain’s colleagues on Capitol Hill, including from both Senate Majority Leader Mitch McConnell (R-Ky.) and Senate Minority Leader Charles E. Schumer (D-N.Y.).

“Very sad to hear this morning’s update from the family of our dear friend @SenJohnMcCain,” McConnell wrote on Twitter. “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.”

“John McCain personifies service to our country,” House Speaker Paul D. Ryan (R-Wis.) said in a tweet. “The whole House is keeping John and his family in our prayers during this time.

Glioblastoma is an aggressive type of brain cancer, and the prognosis is generally poor. Sen. Edward M. Kennedy (D-Mass.) survived less than 15 months after his was found in 2008.

Brain tumor experts said that because the prognosis for glioblastoma patients is so poor, many patients eventually face the difficult decision of when to end treatment.

“Most patients do ultimately have to deal with this,” said John de Groot, a neuro-oncologist at MD Anderson Cancer Center in Houston. “At some point, all existing therapies have been tried, and sometimes experimental ones have been tried, and despite that, the tumor continues to grow. The tumor burden becomes so great that doing anything additional becomes futile.”

Sometimes patients are too sick to make the decision themselves, and rely on family members to decide when treatment should be ended, he said.

McCain’s office has not released a full outline of planned memorial services, but friends and advisers have said they expect that there will be services in Phoenix and then Washington, followed by a private burial at the cemetery on the grounds of the Naval Academy.

When his book, “The Restless Wave,” was published in May, McCain announced that he would buried close to his old classmate, Charles R. Larson, the late admiral who commanded the Pacific fleet and later served as the superintendent of the Naval Academy.

On Friday the Arizona Secretary of State’s office confirmed that when McCain’s seat is vacated, the state’s governor will appoint a replacement, and that person will serve until the next election, which is in 2020.

McCain first arrived on the national stage as a prisoner of war in Vietnam after his plane was shot down over Hanoi in 1967.

In 1982, he was elected to the U.S. House of Representatives. Four years later, he won his seat in the Senate, where he established himself as a leading voice on national security and foreign policy.

McCain, currently the chairman of the Senate Armed Services Committee, has also cultivated a reputation as an independent willing to work with Democrats on issues such as immigration and campaign financing.

In recent years, he has clashed sharply with President Trump, who said early in the 2016 presidential campaign that McCain was not a war hero.

Following his diagnosis and initial treatment, McCain returned to the Senate and cast a pivotal vote against a Republican bill to undo the Affordable Care Act. During a post-midnight roll call on the Senate floor, he turned his thumb down and effectively thwarted one of the GOP’s signature promises of recent years.

Trump has continued to castigate McCain for the vote.

McCain collaborated with a longtime adviser, Mark Salter, on a memoir, “The Restless Wave,” that was released in May.

Among other things, the book captured McCain’s difficult relationship with Trump. The president, he wrote, “has declined to distinguish the actions of our government from the crimes of despotic ones.”

McCain ran for president in 2000, losing the Republican nomination to the eventual 43rd president, George W. Bush. Eight years later, he ran again, this time winning his party’s nomination but losing the general election to Barack Obama.

McCain struggled in 2008 against strong head winds in a banner year for Democrats. Obama and his party scored major victories as voters vented their anger and anxiety over the Iraq War and a struggling economy.

The senator from Arizona selected then-Alaska Gov. Sarah Palin as the party’s vice-presidential nominee, a controversial choice that would become one of the defining decisions of his career.

Two years after running for president, he sought reelection to the Senate. The conservative tea party movement was on the rise in 2010, and McCain tacked to the right to survive a contested primary.

In one controversial campaign commercial, McCain talked about the need to “complete the danged fence” to address concerns about undocumented immigrants crossing the nation’s southern border.

In 2013, McCain moved back to the middle on immigration. He joined the bipartisan “Gang of Eight” senators who proposed a sweeping rewrite of immigration laws that included a path to citizenship for undocumented immigrants.

The bill passed the Republican-controlled Senate but went nowhere in the Republican-controlled House.

Laurie McGinley and Amber Phillips contributed to this report.