The case was heard at the High Court in Christchurch before Justice Nicholas Davidson.
The court heard that Douglas' criminal record included offending which began in Dunedin in April and July 2006, for sexual connection with a young person between the ages of 12 and 16 years. Intensive supervision was ordered.
In 2009, Douglas was convicted for breaching the conditions of intensive supervision and required to come up for sentence if called upon.
In December 2011, he was convicted on a charge of common assault and fined.
On August 15, 2013 he was convicted on 11 charges of possession of objectionable publications. No penalty was imposed as he was already serving the sentence of three years imprisonment for his offending with the teenage boy in June and July 2013.
The court heard Douglas has "an extensive history of problematic sexual behaviour since early childhood" and despite intensive supervision, monitoring and feedback since a child, he is "persistent in engaging in sexually offensive behaviour, often fixated on specific children".
"He has circumvented barriers and manipulated adults knowledgeable about this offending," the court heard.
Douglas, the court heard, has demonstrated a "capacity and proclivity to engage in sexual offending behaviour given the briefest opportunity", even under 24 hour supervision.
"His sexual pre-occupation and impoverished understanding of the effect of his actions means any future sexual offending could occur rapidly upon release should the opportunity afford itself."
Justice Davidson decided that a PPO was the only way to safely manage the high-risk Douglas.
A PPO is a court order that allows the detention of very high risk individuals at a secure facility within prison grounds.
It may be put in place for individuals who have served a finite prison sentence, but still pose a very high risk of imminent and serious sexual or violent offending and cannot be safely managed in the community, Corrections says.
"Whether an ESO with intensive monitoring should be preferred instead of a PPO has proved to be a difficult decision," the judge said in a new ruling.
"It always will be except in circumstances of concurrence between experts and even then it is for the court to make the decision.
"The very idea of containment other than under sentence, albeit in purpose built accommodation, is inherently troublesome. It is reserved for those cases where there is really no option, to avoid the very high, serious, and imminent risk posed by an individual.
"Mr Douglas does pose that risk. He may not do so after treatment, and the passage of time, and under the required reviews the PPO may no longer be considered necessary."
The PPO will take effect on January 10 next year.
He remains under interim detention at Otago Corrections Facility until then.