A policeman hid his laptop computer in a smelly cat litter tray full of excrement when detectives knocked on his door to confront him over child pornography, a judge heard.

Police constable Edward Attwell, of Mayhew Crescent, High Wycombe, also reset his mobile phone to factory settings as officers, armed with a search warrant, continued knocking at his front door.

The detectives, who knew he had been using internet chatroom, did not look in the disgusting cat litter tray on their initial search but found the laptop when they returned and discovered evidence which proved the 43-year-old married officer had shared an indecent picture of a young girl.

Attwell, a serving officer with the Metropolitan Police, was given a suspended sentence by a judge at Aylesbury Crown Court after she conceded that his child porn "fantasy" lifestyle had not involved his work as a police officer.

However, she was told that he was “stressed and withered” by the pressures of being a policeman.

Prosecutor Paul Fairley told the court Attwell was a serving police officer when a Rape and Serious Sexual Offences (RASSO) team received intelligence in connection with the officer.

In a dramatic raid on his family home in High Wycombe, detectives knocked at his door but received no answer for 30 minutes and made inquiries with neighbours, who rang his wife, the court heard.

Mr Fairley told the judge that Attwell's wife returned to the family address and let them into the home – where officers found the defendant with his children, in a state of visible distress.

After ignoring the officers' attempts to gain access, it emerged Attwell had reset his phone to factory settings and hidden his laptop beneath cat litter in a state of blind and frenzied panic, Judge Catherine Tulk was told.

He had engaged in child sex forums while using the online chatroom Kik just days before the raid, on September 7, 2017, when he shared an indecent image of a young girl after one user requested a picture of Attwell's daughter, the court heard.

However, the prosecutor stressed that the image sent was not the former officer's own daughter but that of an unknown girl as part of Attwell's online fantasies.

Attwell was arrested and taken into custody, where he was questioned by officers - who had previously seized his phone – and eventually confessed to the location of the laptop, which the RASSO unit had not initially realised was there.

When officers established the phone and laptop were connected, officers returned his home where they recovered the device in the family cat's litter tray - and hidden beneath cat excrement, Mr Fairley said.

In mitigation, defence barrister Kate O'Raghallaigh told the court that Attwell was a police officer who was left increasingly mentally and emotionally withered under the stress and strain of his work and slipped into a disturbing dark fantasy in online chatrooms.

Ms O'Raghallaigh told the judge he had been left in a state of severe depression following his arrest and mentally deteriorated with the case hanging over him for such a long period.

Judge Tulk was told he had attempted suicide on a number of occasions - but was accepting of his problem with obscene material and wanted to address his personal turmoil.

Ms O'Raghallaigh told how he was left ostracised following his arrest, living away from his family in temporary accommodation with no income and just a few hundred pounds to his name. However, she told the judge there was hope his relationship with his wife may yet be salvaged.

Sentencing Attwell, Judge Tulk handed down a six-month sentence suspended for 18 months, with a 30-day rehabilitation requirement and 100 hours unpaid work.

He was also required to pay £100 towards the prosecution costs and a victim surcharge. The judge ordered the destruction of the phone and laptop once Attwell had received the personal items and images stored on the devices.

Judge Tulk said: "You are 43 years of age. In relation to the indictment... you admitted to two counts of distributing obscene articles and one count of attempting to pervert the course of justice.

“The incidents took place September 1, 2 and 7 2017, and arose from the fact that on September 7 police officers arrived to execute a search warrant and in the space of half an hour not only did you fail to appear because you knew there were items on your mobile phone that were going to get you into serious trouble.

“The fact that at the time you were a serving police officer of 19 years is in no way related to the sentence I am about to pass.

“I am actually convinced what you did in that half an hour was borne of sheer panic and desperation because of what you did.

“You reset your phone to factory settings in the hope officers would not find it on the mantelpiece... you hid the laptop in the cat's litter tray, underneath the litter.

“When police officers were searching the house they did not find it – it was only when they put two and two together and realised there must be a phone connected to it, you told them and they found it.

“When they looked they found conversations in a chat log. It is accepted the photo you sent was not in fact your daughter and I suspect a very large part of what you were saying was sheer fantasy – but it is worrying that you were getting involved in conversations of that nature.

“That covers a large area of the defendant's offending that took place.

“However, none of the evidence was lost. I have been told by the psychological assessment and pre-sentence report, which has set out your history of how your work started to affect your mental health and stress levels and the effect it has had on your life and children.

“The Sexual Risk Order will be a preventative factor in your relationships.

“You don't represent a higher risk of serious harm to the public and there is a realistic prospect of mitigation. I do not take the view the job you were doing before means you must automatically go to prison.

“There is no link - it is not like you were using a computer at work.”