A paedophile had dozens of pictures of children apparently taken outside a Cardiff school on his computer, a court has heard.

Gareth Martin Jordan was exposed after a doctor reported what he had told her to the police.

When police raided his house, they found pornographic photos and movies of young children from levels one to four, with level five being the most serious.

There were also 46 pictures of children walking to school in Cardiff.

In a drawer they found children’s clothing and underwear that he had bought to “replicate” his fantasies.

In June, Jordan, 55, was sentenced to a three-year community order and ordered to complete a sex offender programme after admitting a total of 26 counts relating to indecent images of children.

Police raided his home, at East Road, Tylorstown, Rhondda, twice.

The first time was when a work colleague at Leckwith Retail Park in Cardiff spotted Jordan in the canteen looking at a photograph of a young Asian girl, aged around 12, in an erotic pose on October 18.

He saw him again doing the same thing two days later and decided to report the matter to the police on October 22.

That day police searched Jordan’s home and found a number of images and movies.

Prosecutor Nicola Harris told Merthyr Crown Court there was also a DVD of a beauty pageant at a “nudist or naturist camp” focusing on naked female participants.

Jordan’s home was searched for a second time when Dr Ruth Bagshaw approached police with concerns over Jordan.

“Her duties under the Children Act overrode patient confidentiality,” said Ms Harris.

The court heard he had admitted that he watched girls walk past, had driven to certain locations where he had pleasured himself, and had also followed one girl.

In all, police found 844 static images between levels one and three and 62 movie files between levels one and four.

Magistrates had committed Jordan to the crown court for sentencing after he admitted 14 counts of making and 12 of possessing indecent images of a child.

Ordered to sign as a sex offender for five years, Jordan was also made the subject of an indefinite Sexual Offences Prevention Order (Sopo) limiting his use of devices able to access the internet, which had to be available to be inspected by police.

He was also prohibited from buying female underwear.

But on July 4, as part of the monitoring procedure for the Sopo, probation and police officers attended Jordan’s home.

One of the officers noticed a device to enable a mobile phone to be contacted to the internet.

But when they asked to see it he refused to hand it over, saying he didn’t have it.

When the phone was eventually located it did not contain any indecent images of children but police discovered a memory stick concealed in his bed.

It contained three indecent images of children.

Jordan admitted three counts of possessing indecent images of children, one of making indecent images of children, and breaching the Sopo.

Judge Richard Twomlow made Jordan the subject of a community order to run alongside the existing order, which expires on June 7, 2016.

He was also ordered to complete 100 hours of unpaid work and pay a £60 victim surcharge.

Judge Twomlow told him: “The breach was flagrant and deliberate. Any further breach will result in imprisonment.”