The former auditor general for Wales has been jailed for eight months after possessing more than 170 indecent images of children.
Jeremy Colman, 62, pleaded guilty at an earlier hearing to 15 separate offences after indecent images of children were found on a computer at his offices.
The judge at Cardiff Crown Court told Colman he felt sick looking at the images shown in evidence.
Colman was also ordered to register as a sex offender for 10 years.
Colman has a home at Dinas Powys in the Vale of Glamorgan but has been living near Peterborough in Cambridgeshire.
In sentencing him, Judge Nicholas Cooke QC, the Recorder of Cardiff, said he had caused considerable embarrassment for the Welsh assembly.
The Wales Audit Office is an independent public body which was established by the assembly.
Colman, who stood down from his £170,000-a-year post in February, had been remanded in custody since 1 November after admitting downloading and possessing images of child sex abuse.
Colman also admitted a charge of failing to disclose a password to allow police to access information on a USB memory stick.
The court heard 51 of the images were of level four, the second most serious level.
Prosecutor Roger Griffiths said: "A search of his computer found a large number of pornographic images of males over 18 and of pornographic images of boys.
"Colman had also googled websites for Turkish boys."
Wendy Hewitt, defending, said Colman was twice-married but had been "confused" about his sexuality since a teenager.
She said: "He is not of just good character - but of impeccable character.
"Most of his concern came from his spouse finding out."
As auditor general, Colman was one of the most senior civil servants in Wales overseeing more than £20bn of public money a year.
But while in his office in Cardiff he secretly viewed photographs of child sexual abuse.
The images were described by the judge as utterly revolting material.
In January, Colman told the audit office authorities he had emailed a naked photograph of himself to a contact on a social networking site.
He was advised to take sick leave and an investigation was started.
IT specialists examined his computer and 12 days later the police were called in.
Some 172 images were found on both official and personal computers.
The court was told Colman destroyed the hard drives of four personal computers.
Colman admitted 10 charges of making indecent photographs of a child and four counts of possessing indecent images.
He admitted a further offence of failing to disclose his computer password to police.
Colman, who stood impassive in the dock as he was sentenced, was jailed for eight months and ordered to register as a sex offender for 10 years.
The judge said: "This is a personal tragedy for yourself and your wife but there can be no special treatment because of who you are.
"You have caused the Welsh assembly considerable embarrassment because it is a body which places the highest value on the welfare of children."
The judge added he was conscious that Colman had taken images "which could only have been made by the abuse of children" into the Welsh assembly.
'Looking to future'
"It appears to me that the high watermark of your offending relates to the making, and more significantly the possession, of level-four images," he said.
"I have seen some of those images. It's no exaggeration to say that they are repulsive."
The Wales Audit Office said in a statement after the hearing: "Now this difficult period for the Wales Audit Office has drawn to a close, we are looking to the future and moving forward as an organisation.
"We would again like to thank South Wales Police for their assistance, and thank all those across the public and private sector for their messages of support over the last nine months.
"Our new auditor general and our professional, hard-working staff remain committed to providing a first class audit and review service for citizens in Wales."