Leonard told police he had intended to rape a woman because he could not "get a missus".
The Court of Appeal granted him leave to appeal against the sentence, despite him filing the appeal out of time.
The court was required to consider any pattern of serious offending, the seriousness of harm to the community, any tendency to commit serious offences in the future, and any efforts to address the causes of offending.
It also had to consider whether a lengthy determinate sentence would be adequate in providing protection for society.
The court noted Leonard had previously been sentenced to nine years and six months in prison for raping a neighbour in 2005. He served seven years of that sentence.
His most recent offending was serious and had involved an assault on a young woman, involving a weapon, in a public place in broad daylight.
A psychologist had also assessed Leonard as being at high risk of sexual reoffending.
The court found a sentence of preventive detention was required and dismissed Leonard's appeal.