Douglas Cruikshank and Chelsea Lambie tossed strips of bacon in the window of the mosque and wrapped pieces of pork around the door handles of the place of worship.
Cruikshank, 39, pleaded guilty, but 18-year-old Lambie denied being involved in the attack despite having a message in her cellphone reading, "Went to the mosque in Edinburgh and wrapped bacon round the door handles, opened the door and threw it in ha ha ha."
Lambie was sentenced to 12 months and Douglas Cruikshank was given a nine-month sentence after being convicted of threatening and abusive behavior.
"The Muslim community are a valued and integral part of Scottish society and there is no place for such attacks in modern Scotland," said public prosecutor John Logue. "As we strive to become a fairer and more tolerant society to live in we will not let it be blighted by a narrow minded and hateful minority."
Another man who admitted his involvement, Wayne Stilwel, was sentenced to 10 months in September.
"I was surprised if a person did it for a joke. It is against our culture and religion," mosque security guard Usman Mahmood said during the trial. "We do not eat pork or even touch it. I felt very bad seeing this meat in my sacred place. It hurt my feelings when I saw this meat hanging inside the mosque in the worshipping area. It was very disturbing."
Swim Week Miami Beach 2014 [PHOTOS]