When police raided Samuel Leigh Ebdell's home they were looking for evidence of blackmail.
After analysing his computers they found what they were expecting, but also came across an unanticipated assortment of objectionable material, including a woman performing a sex act on a dog, the Dunedin District Court heard.
The 18-year-old became the subject of police inquiries when a teenage girl complained he had threatened to post a video of them having sex online if she did not send explicit photos of herself.
According to court documents, the pair, who met at a youth group, went to a local cemetery in the defendant's car to have sex some time last year.
Afterwards, Ebdell bombarded the girl with messages on Facebook, instructing her to send nude images.
''He repeatedly messaged her with the request until she finally began to delete the messages,'' a police summary stated.
Ebdell pressed the matter on December 18 when he threatened to disclose the recording of their earlier liaison.
When police spoke to him, he claimed someone must have created a duplicate Facebook account in his name.
Less than a week after the blackmail attempt, police executed a search warrant at the teen's Dunedin home, during which his cellphone was seized.
Forensic analysis turned up a dozen images featuring girls as young as 3.
Many of the acts featured in the electronic files are too graphic to be described.
One of the victims, whose abuse photos had been circulated online, was from the Netherlands and had been abused by a family friend between the ages of 8 and 13, court documents revealed.
Another girl, known as ''Tara'', was the subject of an FBI investigation in 2006, which uncovered a worldwide child sex abuse ring.
During the course of her four-year ordeal, which began at the age of 5, Tara was forced to engage in a horrific variety of sex acts, sometimes with a knife held to her throat.
The FBI arrested her father in the state of Georgia in 2008 but 10 years later, the depraved photos were still being spread online.
Judge John Macdonald yesterday said he had planned to sentence Ebdell, a first offender, to home detention.
However, he was persuaded otherwise by defence counsel Sarah Saunderson-Warner, who said such a punishment would effectively end her client's automotive studies.
The judge said that would be a ''reasonable setback'' for someone so young and noted Ebdell was considered motivated to attend rehabilitative programmes.
The teenager was sentenced to six months' community detention and 15 months' intensive supervision, the terms of which barred him from possessing internet-capable devices or associating with anyone under 16.
Ebdell was also banned from driving for six months for doing ''donuts'' in a South Dunedin car park while on bail.