But while he sat in prison on remand waiting to be sentenced he continued to be paid by education chiefs, it was revealed today.

A victim's parent said it was a "disgrace" that Williams, who admitted his crime in January, was still being paid up until he was sentenced this week.

The parent said: "I am absolutely horrified that this man has continued to be paid thousands of pounds after what he did.

"It's a disgrace and the council should be ashamed of themselves."

Cardiff Council said they could not stop the payments which amounted to £16,000 until Williams had received his sentence and they could carry out formal disciplinary action.

The Welsh Government condemned the local authority's view that disciplinary action couldn't be started against Williams until he was sentenced.

A spokeswoman for Welsh Education Minister Huw Lewis said: "The actions of Gareth Williams were truly horrifying, and it is simply wrong that he should have been paid following his guilty plea."

"I am absolutely horrified that this man has continued to be paid thousands of pounds after what he did."

Victim's parent

Williams, of Rhiwbina, Cardiff, had been deputy headteacher of Glantaf Welsh-language high school in the Welsh capital - the largest Welsh school in the country.

Former pupils at the school include Hornblower and Fantastic Four actor Ioan Gruffudd and former Blue Peter presenter Gethin Jones.

The court heard a total of 31 children at the 1,300-strong school aged between 11 and 16 were caught on camera.

He was investigated by police after computer specialists found he had been buying paedophile images on the internet.

When his home was raided police discovered two laptops and 11 memory sticks along with the pinhole camera gear.

Williams had installed software to browse the internet undetected.

Cardiff Crown Court heard he had 16,419 indecent images of children and 691 videos.

The court heard some of the images dated back to 2009 - a year after he was appointed deputy head at the school.

Williams admitted 31 charges including nine of voyeurism but has been held in prison until he was sentenced to five years in jail on Monday still receiving his salary because Cardiff Council said they couldn't begin disciplinary action against him until all criminal proceedings had been completed.

A spokeswoman said: "The sentencing concluded the criminal case against Mr Williams. Cardiff Council and the governing body are now able to take the appropriate action without delay."