Chelsea Lambie, 18, and Douglas Cruikshank, 39, were ordered to spend 12 months and nine months respectively in custody after wrapping bacon around the door handles of the Central Mosque in Edinburgh and throwing the meat into the premises.
They had earlier gone on trial at Edinburgh Sheriff Court, where Sheriff Alistair Noble told them yesterday: "It does not seem to me there is any way to deal with this case other than by custody."
The pair had initially denied behaving in a threatening or abusive manner likely to cause fear and alarm in the early hours of January 31 last year.
The Crown claimed the offence was racially aggravated although on the final day of evidence in the five-day trial Sheriff Noble deleted the racial aggravation from the indictment and Cruikshank, from Galashiels, pled guilty to the amended indictment.
Asecurity guard at the mosque, Usman Mahmood, 34, told the jury: "I was surprised if a person did it for a joke. It is against our culture and religion. We do not eat pork or even touch it. I felt very bad seeing this meat in my sacred place."
A third person involved in the attack, Wayne Stilwel from Gorebridge, Midlothian, admitted a religiously aggravated attack on the mosque on August 27 last year and was sentenced to 10 months in prison.
The three seen on CCTV at the mosque. When Lambie, from Paisley, was arrested at her boyfriend's home in Gorebridge on January 31, a Blackberry mobile phone was found. A message to the phone asked: "What you do last night?" and the reply: "Went to the mosque in Edinburgh and wrapped bacon round the door handles, opened the door and threw it in ha ha ha".
Google searches on the phone were for the location of the mosque, addresses for taxis in Gorebridge and Dalkeith and at 14.59 on January 31: "Edinburgh mosque bacon search".
In her evidence, Lambie, who had admitted during a police interview to being a member of the Scottish Defence League, denied taking any part in the raid on the mosque. The jury took just over an hour to return a majority verdict of guilty on her.
Defence solicitor Gordon Ritchie told Sheriff Noble his client had become involved in the SDL through close family connections and had gone along with the offence. "She could have said 'No'," he added.
Mr Ritchie said Lambie had now taken steps to distance herself from the organisation by returning to Paisley to live with her partner and young child. He suggested that a Community Payback Order would be appropriate.
Appearing for Cruikshank, Mark Harrower said his client offered to plead guilty last year if the racial aggravation was removed, but the Crown had refused.
"As a result of that, matters dragged on. Mr Cruikshank had no option but to proceed to trial because of the Crown's stance," he said.
He added that Cruikshank had been drinking heavily for 48 hours before the raid on the mosque.
"He thought his actions were a joke at the time, but has expressed empathy that it was unpleasant for the witnesses at mosque."
Sentencing Lambie to 12 months' detention, Sheriff Noble said he accepted she was a mother with a very young child, but she had continued to deny her guilt.
He accepted Cruikshank had tried for many months to plead guilty and told him that if he had been found guilty at trial he would have sentenced him to 13 months in prison, but given his plea to the amended charge, he reduced that to nine months.