Ian Ogilvie, 50, and his friend Allan Donnelly, 47, had preyed on the teenager for months, despite Ogilvie already being on the sex offenders register for life at the time. He was also the subject of a supposedly strict Sexual Offences Prevention Order order banning him from going near under-16s.
The pair were caught after a man allegedly asked to take part in the rape of the child contacted police.
The horrific events emerged in August 2013 when the two men admitted a string of sex charges at an appearance at the High Court in Glasgow. Sentence had been deferred to allow the court to obtain reports about their characters. At their earlier appearance, Judge Lord Pentland warned the duo they had both taken part in a "deeply horrifying level of depravity".
Yesterday, at Ogilvie's sentencing, defence advocate Brian McConnachie, QC, told the High Court in Edinburgh there was very little he could say that would mitigate his client's behaviour.
Passing sentence, Lord Pentland said the most appropriate way to deal with Oglivie was to give him an order for lifelong restriction. The order means the parole board can only release an offender back into society once it has detailed information they pose no serious threat.
Lord Pentland added: "I am satisfied that only an order for lifelong restriction will provide sufficient protection for the public."
During earlier proceedings, the court heard how the victim - who cannot be named for legal reasons - had moved to Scotland six years ago from her home in Thailand.
Donnelly had developed a sick fascination with the schoolgirl and started having sex with her at his home in Airdrie, North Lanarkshire. Then in June 2012, Donnelly introduced the teenager to Ogilvie who was already on the sex offenders register for life. He was jailed in Northampton in 2005 after being caught with a collection of child pornography.
He and Donnelly abused the vulnerable youngster together, often at Ogilvie's home in Motherwell, North Lanarkshire,.
It was also alleged the pair had tried to organise the rape of the girl while she was drugged. One man named as Eric Cunningham was allegedly contacted to take part in the sex attack. Concerned, Mr Cunningham contacted the police in March 2013.
Officers swooped after Donnelly was seen with the girl going to Ogilvie's house.
She later told of her ordeal and the duo were charged.
Officers also seized recordings showing the girl being abused.
The duo both admitted to having sex with a child and making indecent images while Donnelly also pled guilty to charges of sexual assault and taking her to Ogilvie's home for him to abuse her.
Ogilvie also admitted breaching the terms of a Sexual Offences Prevention Order.
The offences took place between June 1 and September 19, 2012.
Lord Pentland sentenced Ogilvie to two years and three months for having sex with a child. In addition, he ordered Ogilvie serve 18 months for making indecent images.
Ogilvie was also given a three-year sentence for breaching the terms of a Sexual Offences Prevention Order. All sentences will run concurrently.
The parole board will also examine whether Ogilvie is eligible for release after he serves two years and three months of his sentence.
Lord Pentland added: "I emphasise this is no more than a minimum period. It certainly does not signify that you are likely to be released at that stage or indeed ever. That, as I have said, will be for others to decide.
"There is an abundance of detailed information before me showing that you are a persistent and dangerous sexual offender. " Donnelly was jailed for 10 years and six months last December for his role in the assaults.