A man with a history of rape has failed in his last-ditch attempt to overturn an indefinite prison sentence.

In a judgment released this morning, the Supreme Court rejected Justin Ames Johnston's appeal against a conviction for attempting to violate a 16-year-old schoolgirl.

Johnston is serving a sentence of preventive detention, meaning he could stay in jail for the rest of his life if the Parole Board thinks he's a risk to the public.

At a trial in Wellington, Johnston, now in his mid-40s, was found guilty of attempting to violate the girl.

Advertisement

Her dad discovered Johnston in the backyard of their Upper Hutt property, where the teen was alone in a sleepout.

Johnston claimed he was intending to commit a burglary and there was no proof he was intent on anything sexual.

He was found guilty at his first trial, but the Court of Appeal set aside the conviction.

However, Johnston was again found guilty at a re-trial.

The Court of Appeal rejected a further appeal, as did New Zealand's highest court today.

Johnston did, however, admit a charge of threatening grievous bodily harm against the girl's father.

When the dad went outside to get firewood one July evening in 2010, he found Johnston lurking near the sleepout and chased him, grabbing him as he tried to scale a fence.

The father put Johnston in an armlock and then applied a choker hold. But when Johnston produced a garden fork and threatened him, the father let go.

A police dog tracked Johnston through the neighbourhood and found him.

The Supreme Court judgments says Johnston raped a 26-year-old and a 15-year-old in the 1990s.