He admitted a further charge of indecent assault on a child under 12 and the attempted abduction of another youngster with the intention of having unlawful sexual connection with her.
Those two charges related to approaches to children in a Tauranga playground last February.
The district court judge declined to sentence Wilson, referring him to the higher court where a more severe sentence could be imposed.
Referring to the playground charges, the judge said Wilson, whom he described as a binge drinker, had gone to a park after a drinking spree. There he pushed a boy on his back, indecently assaulting him.
An adult called police but when they arrived the child had vanished.
Wilson moved to a flying fox where he indecently assaulted a 6-year-old girl before taking her by the hand. This made adults present suspicious that he was planning to take her from the park. They intervened but Wilson retorted he was simply taking her to see some sights.
Referring to the ongoing offending against the child Wilson had molested over a protracted period, Justice Gilbert said his offending had affected her so badly it could well haunt her for the rest of her life.
Referring to a victim-impact statement prepared on her behalf by a psychologist, the judge said the child had been so traumatised by Wilson's offending and his stalking her that she was sent to another school. He tracked her down and she again started missing school.
"Your offending seriously affected her education, she thought she was stupid because she couldn't study, developed self-loathing and low self-esteem," Justice Gilbert told Wilson.
The only time she was free of Wilson's attentions was when he was in jail, also for sexual offending.
Once out, he offended against her again despite being given a first-strike warning. The judge also noted Wilson had offended when on bail.
In prison, Wilson had been found with pictures of children in his cell and had performed indecent acts while looking at magazine pictures of celebrities, often photographed with their young daughters.
"You continued your deviant interests ... it is quite clear you have a propensity for offending against young girls," the judge told Wilson.
Despite 29 sessions with psychologists, Wilson had continued to offend.
His lawyer, Bill Nabney, said Wilson was anxious to receive treatment and engage in any that was offered.
Crown solicitor Greg Hollister Jones pressed for the preventive-detention sentence.
For the playground charges, the judge added a two-year prison term to be served concurrently with his detention period. He noted Wilson had already been issued with his second three-strikes warning.