U.S. Senator John McCain rebukes President Donald Trump in a new memoir, accusing his fellow Republican of failing to uphold U.S. values by showering praise on international 'tyrants,' discrediting the media, ignoring human rights and demeaning refugees.

'Flattery secures his friendship, criticism his enmity,' wrote McCain in 'The Restless Wave,' which he co-authored with longtime aide Mark Salter.

'It is hard to know what to expect from President Trump, what's a pose, what's legitimate,' McCain said in the book that is due to be released on May 22. An advance copy was sent to Reuters by publisher Simon & Schuster.

A final attack: John McCain. who is currently battling brain cancer, is publishing a memoir later this month which will attack Trump

Succor to tyrants: McCain says that Trump calling unflattering news stories 'fake news,' regardless of their validity, 'is copied by autocrats who want to discredit and control a free press.'

'Bigger misfits haven't been seen inside a White House since William Taft got stuck in his bathtub': McCain names Steve Bannon and Sebastian Gorka as two of Trump's 'weirder' advisers

McCain, the 2008 Republican presidential nominee, is still one of the strongest voices in his party on foreign policy, despite a battle with brain cancer.

He has championed civility and compromise in Congress during an era of acrid partisanship in U.S. politics.

The 81-year-old senator has also been both a critic and target of Trump, who during his 2016 presidential campaign disparaged McCain's war record by saying he was not a hero after enduring 5-1/2 years as a prisoner of war in North Vietnam.

In his memoir, McCain said Trump had appeared to mock the idea the United States should promote its values abroad and slammed him for threatening to kill the spouses and children of terrorists during his campaign.

'His lack of empathy for refugees, innocent, persecuted, desperate men, women and children is disturbing. The way he speaks about them is appalling,' said McCain, who still chairs the Senate Armed Services Committee despite his long medical absence from Washington.

He also renewed his criticism of Trump for denigrating the media by calling unflattering news stories 'fake news,' regardless of their validity.

Trump's reaction to such news stories 'is copied by autocrats who want to discredit and control a free press.'

McCaine also writes he's 'not sure what to make of President Trump's convictions'.

McCain mocked Steve Bannon and Sebastian Gorka - whom he called some of Trump's 'weirder' advisers - saying he was relieved they had left the administration.

'Bigger misfits haven't been seen inside a White House since William Taft got stuck in his bathtub,' McCain wrote, referring to early 20th-century President William Howard Taft.

McCain also blasts Trump's tolerance of Vladimir Putin, saying it was 'shameful' when Trump said 'we have killers too' when he was warned about the Russian President, CBS News reports.

He describes Russia as the most defining foreign policy issue for the US currently.

McCain concluded his memoir by citing Robert Jordan, the main character in Ernest Hemingway's 'For Whom the Bell Tolls,' who said as his death approached: 'The world is a fine place and worth fighting for and I hate very much to leave it.'

'And I do too,' McCain wrote. 'But I don't have a complaint. Not a one. It's been quite a ride.'

In an audio excerpt from his book, published by NPR Thursday, McCain says: 'I don't know how much longer I'll be here.

'Maybe I'll have another five years. Maybe with the advances in oncology, they'll find new treatments for my cancer that will extend my life. Maybe I'll be gone before you hear this. My predicament is, well, rather unpredictable.

'But I'm prepared for either contingency, or at least I'm getting prepared. I have some things I'd like to take care of first, some work that needs finishing, and some people I need to see.'

He then talks to his 'fellow Americans', saying: 'We're not always right. We're impetuous and impatient and rush into things without knowing what we're really doing.

'We argue over little differences endlessly and exaggerate them into lasting breaches. We can be selfish and quick sometimes to shift the blame for our mistakes to others. But our country 'tis of thee. What great good we've done in the world. So much more good than harm.'

The excerpt ends: 'Then I'd like to go back to our valley and see the creek run after the rain, and hear the cottonwoods whisper in the wind. I want to smell the rose-scented breeze and feel the sun on my shoulders.

'I want to watch the hawks hunt from the sycamore, and then take my leave bound for a place near my old friend Chuck Larson, in the cemetery on the Severn, back where it began.'

Larson is buried at the U.S. Naval Academy Cemetery in Annapolis, Maryland.