A former assistant chief constable of Cleveland Police yesterday told a court that internal telephone extensions were secretly bugged and calls logged at force headquarters as part of internal investigations into officers.

The disclosure by David Earnshaw was made at Newcastle Crown Court on the second day of the trial of force communications manager Alan Coates, who is charged with downloading child pornography from his office computer.

Senior manager Mr Coates faces 15 charges of making indecent photographs of a child but the jury was told the charges were sample counts and hundreds of images had been downloaded.

Mr Coates, 52, of Forest Lodge, near Bishop Auckland, County Durham, has denied the charges claiming he was framed because of "sensitive" work he was carrying out for Cleveland Constabulary.

The court yesterday heard that Mr Coates had been enlisted by Mr Earnshaw, who was the assistant chief constable, behind the backs of his immediate superiors to help with covert surveillance on the Operation Lancet inquiry and another major investigation by the force into what was known as the Charrington Affair.

That internal investigation centred on alleged links between police officers and a suspected drugs baron, and was launched in 1996, a year before Lancet.

The court was told that Mr Coates had also been asked to "sweep" a hotel conference room where a high-level meeting was to take place to ensure it had not been bugged.

It had also been arranged for him to carry out a similar sweep of Cleveland's main office of the Crown Prosecution Service, but he was arrested on the pornography charges before he was due to do it.

The court was told Mr Coates was asked by Mr Earnshaw to help technicians install a device to monitor two specific extensions at Cleveland Police headquarters as part of the internal investigations.

Beatrice Bolton, defending Mr Coates, said the investigations, which are still running, had "created a climate of mistrust" throughout the force.

She told Mr Earnshaw: "Mr Coates was approached by you in 1996 in order to assist you with your investigation.

"He was asked to assist you without the knowledge of his immediate superior and what he was doing was becoming somewhat indiscreet.''

Mr Earnshaw replied: ''He was asked to do some work for us and was asked to keep that to himself. A black box was installed within the internal system which monitored two extensions."

Miss Bolton said: "Upon his return from the trip abroad, his next job, had he not been arrested on suspicion of these offences, was to sweep Cleveland Crown Prosecution Service offices.

"The perception from outsiders was that Mr Coates now knew a bit about what was going on with these investigations.

''At the same time that Operation Lancet was all over the newspapers and there were suggestions there was hardly one honest police officer in Cleveland.''

Mr Earnshaw replied: "It was getting like Grimm's Fairy Tales."

The court has previously heard that Coates was arrested after a routine check on his office, while he was out of the country, revealed the images on his work computer.

Others were later found on a laptop and floppy discs at his home.

The court heard that the images ranged from innocuous pictures through to extremely hard core images of youngsters and that many had been deleted from his disks.

The hearing was adjourned until today.

The judge, Mr Justice Nelson, told jurors they could expect to hear closing speeches this afternoon and he expected to send them out to consider their verdict tomorrow