A man accused of attempting to sexually violate a teenager says he only intended to burgle the property she lived at.
Justin Johnston, 41, is on trial in the High Court in Wellington, and also faces a charge of threatening to do grievous bodily harm to the girl's father.
He was found in the backyard of an Upper Hutt property near a sleepout in which a 16-year-old girl was alone.
Crown Prosecutor Grant Burston told the court that while in prison in 2006, Mr Johnston told a fellow inmate of his plan to abduct and rape a teenager.
He said that, in 2009, while living in Belmont in Hutt Valley, the accused said similar things to another man.
Defence lawyer Janine Bonfiant said her client had only wanted to burgle the house and had no intention of harming anyone.
She said Mr Johnston was acting in self-defence when he threatened the girl's father.
Mr Johnston was arrested in July last year after a man found him in his backyard.
The man's teenage daughter was alone in a nearby sleepout.