U.S. Senator John McCain wrote in his new book that America should seriously consider a cyberattack to retaliate for Russia's meddling in U.S. elections, to send a strong message to the superpower.

"I'm of the opinion that unless [Russian President Vladimir] Putin is made to regret his decision he will return to the scene of the crime again and again," wrote McCain, the well-known Arizona Republican who is battling brain cancer, DefenseNews reported.

The book, titled "The Restless Wave" and scheduled for a May 22 release, also touches on accusations that Russia could have compromising material related to U.S. President Donald Trump and confirms that McCain has reviewed a copy of the Steele dossier — opposition research authored by an ex-British spy that includes salacious allegations about Trump and his alleged ties to Russia.

Read alsoUkraine energy ministry website hit by ransomware attack – media

Though sanctions and trade restrictions against Putin and his friends are deterrents, "to make Putin deeply regret his assault on the foundation of our democracy — free and fair elections — we should seriously consider retaliating with the kinds of weapons he used," McCain wrote.

"We have cyber capabilities too. They should be used to expose the epic scale of his regime's corruption or to embarrass [Putin] in other ways," McCain wrote.

It's time for America to go on the offensive in the information war with Russia, McCain added.

McCain, the feisty Senate Armed Services Committee chairman and arguably the most prominent defense voice of his party today, announced in book excerpts earlier this month that he will not run for re-election when his current term expires. He has been fiercely critical of Trump since the president took office early last year, particularly for not dealing harshly enough with what he perceives as a growing Russian threat.

Throughout the book, McCain argues for a muscular foreign policy that embraces alliances and champions Western values as morally superior. He also refutes Trump's America First approach as "thoughtless," compounding what he sees as President Barack Obama's foreign policy mistakes.

"I worry we are at a turning point, a hinge of history, and the decisions made tomorrow might be closing the door on the era of the American-led world order," McCain said. "I hope not, and it certainly isn't too late. But my time in that fight has concluded."

Referring to Trump, McCain wrote: "He has declined to distinguish the actions of our government from the crimes of despotic ones. The appearance of toughness, or a reality show facsimile of toughness, seems to matter more than any of our values."