Chelsea Lambie, 18, from Paisley, and Douglas Cruikshank, from Galashiels, wrapped bacon around the door handles on the Central Mosque in Edinburgh and threw strips inside on January 31 last year.
Usman Mahmood, a security guard at the mosque, told the trial why it was offensive for the bacon to be in the mosque.
He said: "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. It hurt my feelings when I saw this meat hanging inside the mosque in the worshipping area. It was very disturbing."
He added the situation could have been "much worse" if there had been more people in the mosque. There was only one man in the prayer room at the time.
The jury were shown CCTV footage from a Tesco store in Dalkeith, Midlothian where two men and a woman could be seen inside at 4.45am on the day of the attack. The woman asked an assistant is she knew where to get the bus to the mosque.
Footage from the Co-op on Nicolson Street, Edinburgh shows the same people at 5.55am, buying two packets of bacon.
CCTV from outside the mosque a short time later shows the trio arrive. Bacon was put on the door handles and the woman took a picture of the men outside the mosque. The three then ran off laughing.