A sex offender who walked into a house in the middle of the night and woke a 16-year-old babysitter has been cleared of any wrongdoing.

Matthew Robinson, 27, was on trial at Swindon Crown Court last week accused of trying to pull down the victim's pyjamas, which he denied, after walking into her bedroom.

Robinson, of Middlefield Road, Chippenham, who was jailed in 2010 for a sex attack on a homeless woman, was cleared of any offences by a jury after telling them he was just a Good Samaritan.

Robinson said he had seen the lights on and door ajar at the house in Chippenham in the middle of the night and went in to warn the occupants.

Although the jury knew of the sex conviction, a judge ruled they should not be told he burgled a house while the occupants slept inside while on early release from prison.

Colin Meeke, prosecuting, told the jury that the 16-year-old was babysitting for her four-year-old niece overnight on October 18 last year.

In the early hours of the following morning she woke to find a man in the room. She told the jury he made sexual remarks to her and then grabbed at her pyjamas and touched her ankles.

The girl said she told him she was only 15 saying, "I thought he would go away because it was classed as paedophile", but she said he told her he was 14 and was called Adam.

Under cross-examination by Marcus Davey, defending, she accepted she was half asleep at the time. The jury also heard from a police officer who arrived on the scene shortly before 1am to find the girl 'hysterical' saying he had tried to pull her pyjamas down.

Robinson pleaded not guilty to sexual assault and trespass with intent to commit a sex act, claiming he had gone into the house fearing it may have been burgled.

He accepted waking the sleeping girl but denied touching her, pulling at her pyjamas or making any sexual remarks.

The jury were told he was jailed for a year in 2010 for a sexual assault on a homeless woman. They were told he followed her across the Bath Road car park making lewd comments before punching her hard in the face, pulling down her trousers and underwear.

But when the headlights of a car illuminated him he fled. The driver of the vehicle recognised him and reported the matter. When Robinson was questioned he said he was a Good Samaritan helping the victim who, he said, had been attacked by someone else.

He was charged with attempted rape, which he denied, but before a jury could be sworn in on the first morning of a trial he pleaded guilty to sexual assault.

Robinson told the jury he was taking a lot of drink and drugs at the time and was "in a dark place".

Despite being cleared of the latest charges he is registered as a sex offender until 2020 as a result of the earlier conviction.