Arizona Republican John McCain is among the most powerful people to have occupied a US Senate seat. An undoubted war hero ­(despite the trashing of his reputation by Donald Trump) who suffered mightily as a ­prisoner of the North Vietnamese from 1967 to 1973, McCain remains passionately committed to the ideals of the American republic.

Twice an unsuccessful candidate for president, rejected by his own party in 2000 (it ­favoured George W. Bush) and by an electorate in 2008 that endorsed Barack Obama, McCain continues to argue eloquently and passionately for the virtues of an America he has unstintingly served, in uniform and in public office.

His new memoir The Restless Wave, written with Mark Salter, a staffer from his Senate ­office, covers much of his recent career. It is compelling reading and at times deeply moving.

The Restless Wave will characterise McCain’s personal and political views, as he battles a ­cancer that is slowly overwhelming him.

McCain begins in Honolulu, at Pearl Harbor. President George HW Bush is delivering an ­address at the USS Arizona memorial on the ­occasion of the 50th anniversary of the ­Japanese attack. Among the dignitaries are two old friends, senators Bob Dole (Republican, Kansas) and Dan Inouye (Democrat, Hawaii), both Medal of Honor recipients for extraordinary bravery in World War II. McCain is overcome emotionally as the Pearl Harbor survivors parade in falling rain.

A little embarrassed by my reaction, I confessed to Dan, ‘‘I don’t know what comes over me these days, I guess I’m getting sentimental with age.’’ Without turning his gaze from the marchers, he answered me quietly, ‘‘Accumulated memories.’’

That was it. Accumulated memories. I had reached an age when I had begun to feel the weight of them.

McCain carries the weight in this memoir ­effortlessly. The title, The Restless Wave, is taken from the words of the US Navy hymn. The reference to the naval traditions of the McCain family — his grandfather and father were both admirals — is unstated but real.

This is not McCain’s first collaboration with Salter. They have co-written several books on the American experience, including Thirteen Soldiers and Worth the Fighting For. Their other notable achievement has been Faith of My ­Fathers: A Family Memoir. But it is The Restless Wave that will characterise McCain’s personal and political views, as he battles a ­cancer that is slowly overwhelming him.

This is a generous book. McCain shows ­affection for friends and colleagues on both sides of the Senate aisle. His closest Senate buddies are Lindsey Graham (Republican, South Carolina) and Joe Lieberman (independent, Connecticut). It may be recalled that former senator Lieberman, once a Democrat, was Al Gore’s running mate in the 2000 election.

Graham and Lieberman often travel with the author to distant and violent parts of the planet, searching for solutions, but McCain also worked closely with Edward M. Kennedy (Democrat, Massachusetts) and former vice-president Joe Biden, among others.

McCain is an American patriot in the finest sense of the word. But he also remains an internationalist and committed to the liberal global order that Harry Truman started constructing in 1946. He is a good friend of Australia and ­understands the value of US allies.

Indeed, one of the book’s funnier moments, comes during the 2008 presidential campaign. Teddy Kennedy has just endorsed Barack Obama over Hillary Clinton in the Democratic primaries. McCain is campaigning for the ­Republican nomination, supported by Graham, when Kennedy calls to congratulate him on having won the South Carolina primary.

We traded gossip for a few minutes, and then Lindsey asked me to pass the phone to him. ‘‘Ted,’’ he drawled, ‘‘can I have your hideaway office?’’

Senators have small offices in the Capitol building in addition to their official offices. Many are cubbyholes tucked away in the basement or a back hall. The most senior senators have grander ones, with views of the Mall. Ted’s was the nicest.

‘‘Why?’’ Ted asked.

‘‘Because the Clintons are going to have you murdered,’’ Lindsey explained.

I could hear Ted’s laughter boom from the phone Lindsey held several feet away, over the din of the crowded bus.

McCain is an American patriot in the finest sense of the word. But he also remains an internationalist and committed to the liberal global order that Harry Truman started constructing in 1946. He is a good friend of Australia and ­understands the value of US allies.

In a May 2017 speech for the United States Studies Centre at the University of Sydney, McCain argued firmly that not only was there still a bipartisan consensus in congress for internationalism, but that consensus still commanded a majority among Americans.

This may be challenged given the Trump ­administration’s predilection for withdrawing from international agreements and squabbling publicly with close allies such as the Canadians and the Germans. But McCain not only clearly believed what he said was true, he has been ­prepared to on occasion to risk his political ­career on the simple notion that Americans understand their global obligations.

The best example of this occurred in the New Hampshire primary in March 2008. McCain was openly backing an unpopular surge by the US military in Iraq to prevent that country’s collapse. His youngest son, Jimmy, was a US marine deploying to Iraq and McCain decided to fight the primary on his support for the surge.

Accepting the advice of his campaign ­manager Steve Schmidt, McCain made a virtue of necessity and stuck to his guns during the poll. He won handsomely, against the odds.

McCain now acknowledges his mortality, in a telling account of a conversation on foreign policy with Obama late in his presidency.

No minds were changed in the encounter, but I appreciated his candour as I hoped he appreciated mine, and I respected his convictions. Yet I still believe his approach to world leadership, however thoughtful and well intentioned, was negligent, and encouraged our allies to find ways to live without us, and our adversaries to fill the vacuums our negligence created. And those trends continue in reaction to the thoughtless America First ideology of his successor … I worry that we are at a turning point, a hinge of history, and the decisions made in the last ten years and the decisions made tomorrow might be closing the door on the era of the American-led world order. I hope not, and it certainly isn’t too late to reverse that direction. But my time in that fight has concluded.

This is, of course, the Republican Party of Theodore Roosevelt, Ronald Reagan and ­George HW Bush speaking. He is clearly pessimistic about the historic hinge on which global politics now rests, and who can blame him? McCain, like Reagan, sees America as a shining city. He does not gloss over stains on its reputation, such as extraordinary rendition and the abuses at Abu Ghraib, Bagram and elsewhere. Thus, he refused to vote for Donald Trump’s nominee for CIA director, Gina Haspel, because of her perceived role in human rights abuses.

McCain remains a politician of conviction, far from perfect. His book reflects on his recent journeys in a lifetime of dedicated service. For those wishing to turn the coin over from the Trump administration, this is superb reading.