Two members of the community anti-paedophile group went to Kenneth Long’s home in Armadale, West Lothian, to confront him, a court heard.
But a mob chanting “Beast!” and “Get him out!” quickly formed outside the house in the town’s Mayfield Drive as video of the encounter was streamed live via Facebook.
Police arrived in force to restore order and take Long – already a registered sex offender – into protective custody for his own safety.
Edinburgh crime news: Teenage boy arrested after riding motorbike in a 'dangerous manner in a public place'
Edinburgh fire: Blaze breaks out at Franco's fish and chip shop in Newington
Edinburgh fire: ‘I knew I had to just get out’: Residents evacuated as fire breaks out in Newington area of Edinburgh
Crime: Teenage thug who fathered a child during sentence is back behind bars
A 'deteriorating' footbridge over the Water of Leith has been closed
Long was “visibly upset and shaking” after the incident, as was his partner, fiscal depute Jim Robertson told Livingston Sheriff Court.
Mr Robertson said the apparent aim of the “Wolf Pack Hunters” had been to knock on the accused’s door and ask him about contact he had been having with a “decoy” called Thom on a gay dating app.
He said: “There was already a group of around ten people outside the locus whom they did not know.
“This was all streamed live via Facebook. Nobody answered the door although the accused and his partner were in.
“Very quickly a large group formed outside the locus and were shouting: ‘Get him out!’ and ‘Beast!’
“This escalated with Wolf Pack members banging on the accused’s windows and doors and one member climbing into the living room and taking a photograph of the accused’s partner, telling her what he had been doing.
“This went on for about half an hour, when the police attended as the situation was very volatile.”
As the baying mob increased public order officers intervened to break up the crowd, closing surrounding roads and setting up a cordon.
Long, 53, currently a prisoner at HMP Addiewell, pled guilty yesterday to a grooming charge.
He admitted to sending an image of a naked penis via social media to a person he believed was a 12-year-old boy from his then home between May 28 and June 24, 2018 “for the purpose of obtaining sexual gratification or humiliating, distressing or alarming him”.
Mr Robertson told how a member of the group – an adult male – acted as a “decoy” and set up a false profile on the online gay dating app BoyAhoy posing as Thom, a 12-year-old boy.
“During the first few weeks of contact it appears the conversation was non-sexual after which the accused sent the decoy an explicit picture and the conversation became sexual.”
Sheriff Martin Edington added Long’s name to the sex offenders’ register and called for a criminal justice social work report on his background.
He told the accused: “In view of the nature of this conviction and your schedule of previous convictions I’m going to defer sentence for around three weeks for a report covering supervision, unpaid hours of work and a restriction of liberty assessment. You’ll remain in custody until then.”
He said Long would be told how long he would remain subject to sex offender notification requirements when he was sentenced on 1 November.