A West Mercia policeman who secretly hacked into colleagues computers has been given a suspended jail sentence and has lost his job.

Aled Lewis, a 34-year-old constable stationed at Droitwich, bought a device known as a key logger through Amazon on the internet, but he attached it to computers at the police station which enabled him to access the emails of Sgt Lloyd Buffery and Constable Sarah Cook.

When the device was discovered, Lewis refused to say what had happened to it and it had never been found, said prosecutor Christopher Lester at Worcester Crown Court.

Lewis, of Penmanor, Finstall, Bromsgrove, pleaded guilty to four charges of causing a computer to perform a function to secure or enable unauthorised access to a program or data between July and October,, 2011.

Mr Lester said initial fears were that the force's security had been compromised but this had not been the case. It was the personal accounts of individuals that had been accessed.

A not guilty verdict was recorded on a charge of misconduct in public office and two similar charges were allowed to lie on the file and not be actioned without leave of the court.

Lewis was sentenced to six months jail suspended for 12 months and ordered to do 200 hours unpaid work for the community and pay £750 costs.

Mr Lester said 3,327 emails had been accessed and Lewis had also delved into Facebook accounts. A racist comment had been made in one instance.

Lewis had been suspended after interviews with fellow officers. Personal statements had been made by Sgt Buffery and Pc Cook and these showed how they had been badly affected.

Brian Dean, defending, acted for maximum credit to be given for the guilty pleas Lewis's letter of resignation had been submitted last week. "He has lost his job, his career and will have difficulty in future employment," he said.