A Kent-based officer at a top-security prison became the "paid mole" of a reporter working at the Daily Mirror and News of the World over the course of five years, a court heard.
Robert Norman, 54, is on trial at the Old Bailey charged with misconduct in a public office while working at HMP Belmarsh, south London, which was home to a number of high-profile prisoners.
He was allegedly paid more than £10,000 for 40 tips to reporter Stephen Moyes (pictured) between 30 April 2006 and 1 May 2011.
Opening the case, prosecutor Julian Christopher QC said Norman was an "extremely experienced" prison officer, having been appointed in 1992.
He was also a member of the Prison Officers' Association, acting as union representative to colleagues.
Norman first phoned the Daily Mirror in 2006 and gave Moyes a story about staff cuts at the prison, for which he was paid £400.
The exclusive story described Belmarsh as a "terror prison" and ran alongside a photograph of one of its most notorious prisoners, "hate preacher" Abu Hamza, the court heard.
As the relationship developed, it became a "two-way affair" and Norman carried on dealing with Moyes when the journalist moved to the NoW.
Christopher said: "Sometimes Robert Norman would approach Stephen Moyes with something he thought would be of interest, at other times Stephen Moyes would approach Robert Norman for inside information about a topic in which he was interested, or for confirmation which he would not be able to get for free from the official channels at the Ministry of Justice press office.
"Effectively, Robert Norman became the journalist's paid mole within HMP Belmarsh."
The court heard that when Norman was arrested in 2013 he maintained he had acted in the public interest as a whistleblower.
But Christopher said: "Whilst there may well be quite a number of stories which would be said to varying degrees to be concerned with issues in the public interest, the prosecution alleges it is plain that this was not the behaviour of a conscience-driven whistleblower, moved by the desire to see change and accountability where otherwise there would be none."
Cheques for the stories were made out to Norman's son Daniel and the money was then transferred into Norman's account, showing he was "worried about the trouble he would get into" if found out, Christopher said.
The prosecutor said not all the stories Norman handed to Moyes were about staff cuts and security issues.
Some were about particular prisoners, colleagues, and even officers he had been involved with in his capacity as union representative.
Norman, of Milton Street, Swanscombe, denies the charge against him.
The trial continues.