A convicted sex attacker has been jailed for life after police used CCTV and facial recognition software to identify him.
Craig Walters followed his victim off a bus in Cardiff before attacking her - weeks after being released from prison for a similar offence.
Cardiff Crown Court heard that Walters had planned the attack in November 2019, taking pictures of other female passengers in the days leading up to the incident.
Footage played in court shows Walters' victim getting off a bus in Pentwyn at 10:50pm, followed by the defendant.
CCTV shows him walking behind her as he followed her along a road. He then grabbed her from behind, before dragging her onto a patch of grass.
A passer-by heard the victim’s screams and intervened, chasing Walters off before the attack could continue.
But when the victim was unable to give a description of her attacker, South Wales Police turned to footage captured by on-board CCTV cameras from the bus.
Using facial recognition software, they were able to match the image of the suspect to Craig Walters.
Bethan Evans, from the Crown Prosecution Service, said, “Facial recognition software was used in this particular case in order to identify Craig Walters from the bus CCTV footage.”
“Also in this case we were able to use CCTV footage to paint a picture.
"We were able to show that the victim and defendant travelled together on the same bus, and that the defendant followed his victim when she got off the bus.
"He did it so he could attack her only moments after she got off the bus.”
Walters was arrested by police after the incident on 10 November 2019.
The CPS were able to use Walters’ record of sexual offending to bring a charge of committing an offence with intent to commit a sexual offence.
The court heard the 39-year-old had a string of convictions for offences including attempted rape, indecent assault and grievous bodily harm going back to 1996.
In 2005 he was given a life sentence, serving 14 years in prison. Shortly after his release on licence, he carried out the attack in Pentwyn.
When he was arrested, Walters, of Grangetown, Cardiff, asked police "Is this because of my previous?"
He said he'd spent the day in question watching football, and blamed cuts and scratches on a fall down the stairs.
But, after examining his smart phone, officers found images he had taken of women on board a bus - proof, the court was told, that he had planned to carry out an attack.
“Craig Walters is someone who on previous occasions has targeted women, especially those who’ve been travelling on their own and in the dark", said Ms Evans.
“And on each of those previous occasions, his motivation for targeting those women has been to carry out a sexual assault.
“So, we were able to use that as evidence to support our application to adduce his offending history.”
DC Dave Simmons from South Wales Police described Walters as a "cold and dangerous individual who as shown no remorse".
"I believe he only pleaded guilty because of the strength of the evidence. I hope the successful outcome of this investigation will give other victims the confidence to come forward."
Walters' victim, who cannot be named for legal reasons, told the court that the attack had left her feeling "disgusted", and unable to to walk down the street without looking over her shoulder.
"I don't go anywhere on my own", she said, adding that the experience had caused her to suffer from depression, anxiety and paranoia. "I don't know how to let it out. I don't want anyone else to go through the same thing."
Walters pleaded guilty to false imprisonment and committing an offence with intent to commit a sexual offence.
He was given a life sentence for each offence and told he must service a minimum of six years in prison before being eligible for parole.
Walters was also ordered to sign the sex offenders' register for life.