WikiLeaks founder Julian Assange was warned that the US government wanted to set him up, according to an unofficial autobiography that has been published despite his attempts to block its release.
In the book, titled Julian Assange: The Unauthorised Autobiography, the controversial whistle-blowing website's creator also admits sleeping with the two women who have made sexual assault claims against him.
But he says the rape allegations are either part of the US conspiracy against him or motivated by his failure to return their calls.
Publishers Canongate Books decided to put the memoir on sale after Assange, who is on bail in Britain facing extradition to Sweden, attempted to cancel his contract after reading a first draft.
In one excerpt, published by the Independent, the hacker gives his version of the background to the sexual assault allegations, claiming he met both women - named only as A and W - in Sweden during the furore that surrounded his website's leaking of sensitive US documents, before having consensual sex with them.
"I did not rape those women and cannot imagine anything that happened between us that would make them think so, except malice after the fact, a joint plan to entrap me, or a terrible misunderstanding that was stoked up between them," he says.
"I may be a chauvinist pig or some sort but I am no rapist, and only a distorted version of sexual politics could attempt to turn me into one. They both had sex with me willingly and were happy to hang out with me afterwards."
Assange, 40, who made headlines around the world with revelations from leaked US military files and diplomatic cable, also reveals how a contact in a Western intelligence agency told him that the American government was considering dealing with him "illegally".
He said the source said means such as planting drugs and child pornography or embroiling him "in allegations of immoral conduct", were being discussed.
Assange said he wanted to cancel his contract in June, but by this time he had already signed his advance over to his lawyers to settle his legal bills for fighting extradition. Edinburgh-based Canongate said it would pay royalties to Assange, who is currently living at his bail address of Ellingham Hall in Norfolk.