A serial child rapist who filmed the horrifying abuse of victims has been jailed for a decade.

Robert McGregor preyed on youngsters he groomed and exploited for 13 years.

Police caught him with a cache of indecent images last May which led them to identify three victims he had sexually assaulted.

One of the 36-year-old's victims was aged three.

A senior police officer said that "a case this harrowing is rarely seen in Scotland."

Judge Lady Carmichael told McGregor at the High Court in Edinburgh: "Your sexual offending is of the most serious and appalling nature."

She pointed out McGregor had formed relationships with families in order to gain access to children who he then subjected to abuse.

The judge said his youngest victim was "extremely vulnerable".

Lady Carmichael told McGregor she would have jailed him for 15 years but for his early guilty pleas to the catalogue of offences.

The judge also ordered he be kept under supervision for a further five years on his release.

Lady Carmichael said she was not satisfied that the risk criteria were met for imposing a life sentence on McGregor.

One man branded McGregor an "animal" as he was led off to start his sentence.

The child abuser's home on Friars Street in Inverness was raided by police in May last year and laptops and other items were seized for analysis.

Advocate depute Jo McDonald said a search warrant was granted to police after intelligence was received from the National Online Child Abuse Prevention Agency.

More than 2000 indecent photos and 899 videos were recovered, many of which were found to contain materiel at the most extreme level of abuse.

The prosecutor told the High Court: "In one case officers produced stills of a child from video footage and images were shown to a staff member at a school who identified the boy.

"They traced the ex-pupil and the man broke down when they asked if he had suffered abuse from McGregor."

McGregor had uploaded five videos to a peer-to-peer internet app which allowed others around the world to view the footage of his abuse of one of his victims.

At the High Court, McGregor admitted three charges of raping three boys, sexually assaulting one youngster, making indecent photos of children and distributing or showing indecent photos.

His sex assaults on children spanned more than a decade between 2001 and 2014 and all the attacks occurred in the Inverness area.

The advocate depute said McGregor's offending had had a profound effect on some victims.

Defence solicitor advocate John Keenan said: "On any view this is an extremely serious catalogue of offences in a variety of different ways."

He added that "mercifully" the youngest victim appeared to have no recollection of what happened.

McGregor was told he would be on the sex offenders register indefinitely.

Detective inspector Mark Lambley, of the National Child Abuse Investigation Unit, said: "Robert McGregor preyed on young children and abused the trust of the families involved through his abhorrent and unforgivable offending.

"A case this harrowing is rarely seen in Scotland and will understandably send shock waves through our local communities.

"It is hoped, however, that today's sentencing sends out a clear message that Police Scotland will robustly and sensitively investigate all reports of sexual abuse - regardless of when the abuse took place - helping to ensure we keep everyone safe."

He added: "Police Scotland would take this opportunity to emphasise it is never too late to report abuse - we encourage anyone with concerns relating to the safety or well-being of a young person or any member of the community to make contact with Police Scotland, their local social work department, Crimestoppers or a partner agency such as NSPCC, where action will be taken to protect children and to prevent abuse."