U.S. Sen. John McCain, R-Ariz., apparently has no regrets about his role in the release of the so-called Steele dossier, which is said to contain salacious allegations about then-candidate Donald Trump.

In excerpts of his forthcoming book, “The Restless Wave: Good Times, Just Causes, Great Fights, and Other Appreciations,” the 81-year-old senator – who is recuperating at home following recent cancer treatment and surgery – acknowledges that he delivered the information to then-FBI Director James Comey.

“(A)nd I would do it again,” McCain writes, according to excerpts published by the Guardian.

“Anyone who doesn’t like it can go to hell,” McCain adds, saying he did “what duty demanded I do.”

The “disturbing” nature of the allegations against Trump prompted his action, McCain writes.

“I had no idea which if any were true,” the senator writes. “I could not independently verify any of it, and so I did what any American who cares about our nation’s security should have done.”

“I could not independently verify any of it, and so I did what any American who cares about our nation’s security should have done.” — U.S. Sen. John McCain, R-Ariz., writing in "The Restless Wave"

In December, Fox News reported that former British spy Christopher Steele instructed Sir Andrew Wood – a former British ambassador to Russia – to approach McCain about the existence of the dossier while Wood and McCain were both attending a security conference in Canada.

McCain later received hard copies of the dossier from Fusion GPS, and relayed a copy to the FBI, Fox News reported.

Also in the excerpts that appear in the Guardian:

McCain claims Republicans are on the “wrong side” of the immigration debate, arguing that it has been driven by “zealots” who fail to understand immigration’s key role in “America exceptionalism.”

The anti-immigration zealots “need to be confronted before their noxious views spread further and damage for generations the reputation of the Republican Party,” McCain writes, according to the Guardian.

McCain also expresses regret for choosing Sarah Palin as his running mate in 2008, instead of his friend, former U.S. Sen. Joseph Lieberman, D-Conn.

"The Restless Wave" is set to be published May 22.

Fox News’ Catherine Herridge, Pamela K. Browne and Cyd Upson contributed to this report.