US Senator John McCain, a former prisoner of war in Vietnam who ran unsuccessfully for president as a self-styled maverick Republican in 2008 and became a prominent critic of President Donald Trump, has died at the age of 81.

Mr McCain, a US senator from Arizona for more than three decades, had been battling glioblastoma, an aggressive brain cancer, since July 2017 and had not been at the US Capitol in 2018.

He also had surgery for an intestinal infection in April.

His family announced on Friday that Mr McCain was discontinuing further cancer treatment.

"Senator John Sidney McCain III died at 4.28pm on August 25, 2018. 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," a statement from his office said.

Read more:
John McCain: A military career followed by 35 years in politics

Mr McCain will lie in state in both Phoenix, Arizona, and in the Capitol Rotunda in Washington, DC, and will receive a full dress funeral service at the Washington National Cathedral before being buried in Annapolis, Maryland, his family said.

Former President Barack Obama, former President George W Bush and former Vice President Joe Biden were expected to give eulogies.

Vice President Mike Pence was expected to represent the current administration, the family said. No further details were provided immediately.

"My heart is broken. I am so lucky to have lived the adventure of loving this incredible man for 38 years," Cindy McCain wrote on Twitter.

"He passed the way he lived, on his own terms, surrounded by the people he loved, in the place he loved best."

Taoiseach Leo Varadkar also paid tribute to Mr McCain, saying that he was a "wise and remarkable statesman".

He said: "On behalf of the people of Ireland, I extend my deepest sympathies on the death of Senator John McCain, a wise and remarkable statesman, US ally of Ireland and a proud Scots Irishman who was a champion for immigration reform in the US Senate."

The vacancy created by Mr McCain's death narrowed the number of Republican-held seats in the 100-member US Senate to 50 seats, with Democrats controlling 49 seats in the upper chamber.

Republican Arizona Governor Doug Ducey was expected to appoint a member of his own party to succeed McCain.

That could also give Republicans a slight edge in the battle to confirm Brett Kavanaugh to the US Supreme Court in the weeks ahead because Mr McCain had been too ill to cast any votes this year.

Alternatively affable and cantankerous, Mr McCain had been in the public eye since the 1960s when, as a naval aviator, he was shot down during the Vietnam War and tortured by his North Vietnamese communist captors during five-and-a-half years as a prisoner.

He was edged out by George W Bush for the Republican presidential nomination in 2000 but became his party's White House candidate eight years later.

After gambling on political novice Sarah Palin as his vice presidential running mate, Mr McCain lost in 2008 to Democrat Barack Obama, who became the first black US president.

Paying tribute to his one-time election opponent, Mr Obama said in a statement he and Mr McCain, despite their "completely different backgrounds" and political differences, shared "a fidelity to something higher - the ideals for which generations of Americans and immigrants alike have fought, marched and sacrificed.

"We saw our political battles, even, as a privilege, something noble, an opportunity to serve as stewards of those high ideals at home, and to advance them around the world."

Mr McCain flew attack planes off aircraft carriers during the Vietnam War.

He was preparing for a bombing run in 1967 when a missile inadvertently fired from another plane hit his fuel tanks, triggering a fatal explosion and fire. He suffered shrapnel wounds.

A few months later on 26 October 1967, Mr McCain's A-4 Skyhawk was shot down on a bombing mission over North Vietnam's capital and he suffered two broken arms and a broken leg in the crash.

A mob then dragged him from a lake, broke his shoulder and stabbed him.

Held at the notorious "Hanoi Hilton" prison and other sites, Mr McCain was beaten and tortured, suffering broken bones and dysentery. He was released on 14 March 1973, but was left with permanent infirmities.

In Congress, Mr McCain built a generally conservative record, opposing abortion and advocating higher defence spending.

He supported Mr Bush's 2003 invasion of Iraq and criticised Mr Obama for not doing more to intervene in Syria's civil war.

Still, he prided himself on his reputation as a maverick and had a history of working across party lines on immigration, climate change and campaign finance reform.

He also spoke out against the Bush administration's use of waterboarding, a torture technique that simulates drowning, and other harsh interrogation tactics on detainees in the aftermath of the 9/11 attacks.

He urged the closure of the prison for foreign terrorism suspects at the US naval base at Guantanamo Bay, Cuba, and also sponsored an anti-torture measure that passed Congress in 2005.

Mr McCain wrote in a 2002 memoir: "I'm an independent-minded, well-informed public servant to some. And to others, I'm a self-styled, self-righteous maverick pain in the ass."

He was born on 29 August 1936, at an American naval installation in the Panama Canal Zone - US territory at the time - where his father was stationed.

He acknowledged he was a "smart ass" during his years at the US Naval Academy and graduated fifth from the bottom of his class.

Mr McCain divorced his wife Carol after 15 years of marriage in 1980 and weeks later married the former Cindy Henley, daughter of a wealthy beer distributor in Arizona.