Alastair Campbell's diaries have revealed a four-letter outburst over how Dr David Kelly's emergence as the possible source of the Iraq dossier story could help defeat the BBC.
Mr Campbell is leaving his Number 10 post
Extracts of Mr Campbell's bluntly-worded thoughts were published on the Hutton inquiry's website as he was cross-examined in the latest hearings about Dr Kelly's death.
The personal diary comments were written at the height of the feud between Mr Campbell and the BBC over claims that the government "sexed-up" intelligence on Iraq.
The Downing Street media chief wrote on 4 July that "it would fuck" BBC reporter Andrew Gilligan if Dr Kelly was the source, because he was not "a spy or full-time MoD official".
The Hutton inquiry is examining events surrounding Dr Kelly's apparent suicide, after he was named as the suspected source for Mr Gilligan's BBC report.
The diary entry for 4 July 2003 tells how Defence Secretary Geoff Hoon had revealed an official had come forward about meeting Mr Gilligan.
The man, now known to be Dr Kelly, said he had told Mr Gilligan that intelligence was added to the Iraq dossier late but had not made other claims - such as that Mr Campbell had inserted material against the wishes of the intelligence services.
It continues: "It was double-edged but GH (Geoff Hoon) and I agreed it would fuck Gilligan if it was his source.
"He said he was an expert rather than a spy or full time MoD official."
Mr Campbell took his turn in the witness box after the under-fire Mr Hoon said he still believed the government had done nothing wrong in the run-up to Dr Kelly's death.
During intense exchanges with the Kelly family's barrister, Mr Hoon said there was not the "slightest shred of evidence" for suggestions that the government deliberately leaked the scientist's name.
The diaries say Mr Campbell spent most of the following weekend in talks with Prime Minister Tony Blair and Mr Hoon about the BBC source.
They say Mr Hoon, like Mr Campbell, wanted to "get it out" that the source had "broken cover" to say Mr Gilligan had misrepresented him.
Mr Campbell told the inquiry that he was talking about telling the BBC governors and the Commons foreign affairs committee, rather than making anything public.
The diary entry for 6 July continues: "I wanted, and GH did, to get it to the BBC governors that we may know who the source was, that he was not a spy, not involved in the WMD dossier and was a WMD expert who advised departments.
"TB was fine about that but backed off after talking (Sir David) Omand (Cabinet Office intelligence chief) who felt the guy had to be treated properly and interviewed again. GH and I felt we were missing a trick."
It adds: "My worry was that I wanted a clear win not a messy draw..."
On 9 July, Mr Campbell writes that "the biggest thing needed was the source out". They agreed they could not do it themselves but later that day newspapers worked out Dr Kelly's identity.
The entry for 15 July, the day Dr Kelly faced MPs questions, says Mr Campbell predicted the hearing "would be a disaster and so it proved. Despite MoD assurances he was well schooled".
Questions have been raised about why Mr Campbell did not tell a committee of MPs about all of the suggested changes to the dossier he had made to Mr Scarlett.
Mr Campbell said while some of these points, which related to how the dossier should be presented, had strengthened the text, others had weakened it. The intention was to provide more clarity.
One left off the list he provided to the MPs concerned the controversial claim that Iraq could deploy some weapons of mass destruction within 45 minutes.
But Mr Campbell: "I was pointing out an inconsistency... I was not suggesting how that inconsistency should be addressed...I was therefore not making the request for a change."
Earlier, as the inquiry entered its final week, Mr Hoon said that in hindsight, decisions "could have been taken slightly differently", but that would not have had "any material effect".
He said he had authorised the press statement which led to Dr Kelly being named as the suspected source.
And he still thought it had been right to put out that press release, which said an unnamed official had admitted meeting Mr Gilligan.
Mr Hoon, widely seen as the most likely casualty of the inquiry, said he had also known MoD press officers would confirm Dr Kelly's name if it was put to them.
The ministry's top civil servant, Sir Kevin Tebbit had told him he did not want individual press officers to "be seen to be lying to journalists", he said.
Mr Hoon said he and others had always thought Dr Kelly's name would become public sooner rather than later.
And he said he had asked his officials to report to him on the scientist's welfare.
As tensions rose in the courtroom, Mr Hoon said Kelly family QC Jeremy Gompertz was suggesting there was some sort of conspiracy right across government, but "there was no such conspiracy".
And he had not known about details Number 10 were putting out about Dr Kelly.
Mr Hoon accepted newspapers had exaggerated the Iraq dossier's 45-minute claim but said it was not his duty to correct such false impressions.