In this photo, a pug dog stands in the exhibition hall on the final day of the annual Crufts dog show at the National Exhibition Center in Birmingham, England, March 13, 2011. Getty Images/ Oli Scarff

The man who taught his girlfriend’s pug the Nazi salute was convicted of committing a hate crime on Tuesday.

In the video, titled “M8 Yur Dug's a Nazi", which 30-year-old Mark Meechan of Coatbridge, Lanarkshire in Scotland, recorded, the pug named Buddha is seen watching videos of Adolf Hitler’s speeches and reacting to the words “gas the Jews.” Every time the words are spoken – 23 times to be exact – Buddha’s ears perk up, its eyes grow wide and it turns around and stares at Meechan.

Toward the end of the video, Meechan is seen repeating the words “Sieg Heil" and the dog is seen extending its right paw, mimicking a Nazi salute every time. The camera pans around at times to reveal a snickering Meechan.

The video, which was uploaded a year ago and watched more than 3 million times on YouTube, was branded “grossly offensive” by the Scottish court. However, Meechan, who posted the video on his YouTube channel called “Count Dankula” denied being guilty of any wrongdoing in front of the court, Independent reported.

Meechan said that he trained the dog as a joke to annoy his girlfriend. He also had no idea that the video would go viral, as he thought its views would be limited to his friend circle who subscribe to his channel. At present the channel “Count Dankula” has more than 120,000 subscribers.

He also added that he was inspired to make the video after watching famous Jewish comedian David Baddiel and that it was for “the purposes of comedy.” It was "extraordinary bad luck" that someone who spotted the video shared it on the social platform Reddit. This led it to go viral on the internet, he said.

The original video still exists on YouTube. However, the self-broadcasting channel has inserted a disclaimer at the beginning of the video and comments have been disabled.

Meechan and his girlfriend recorded their apology for making the video after the original video went viral and the Scottish YouTuber started receiving backlash.

Before giving his verdict, Sheriff Derek O'Carroll said that he did not believe Meechan’s defense. He said Meechan was aware of the anti-Semitic tone of the video and yet had "not taken any steps to prevent the video being shared publicly".

O'Carroll said that he took offense to one particular phrase used in the video. "He said he chose 'gas the Jews' as it was the most offensive phrase associated with the Nazi's that he could think of. It was the centerpiece of the joke. He said it was so extreme that it added to the comedy,” he added.

He added that Meechan was guilty of sending by "means of a public electronic communications network a message or other matter that is grossly offensive or of an indecent, obscene or menacing character".

Ephraim Borowski, 66, director of the Scottish Council of Jewish Communities (SCoJeC), who had lost family members in the Holocaust, testified in the court regarding the video.

“My immediate reaction is that there is a clear distinction to be made between an off-hand remark and the amount of effort that is required to train a dog like that, I actually feel sorry for the dog. In many ways, the bit I found most offensive was the repetition of 'gas the Jews' rather than the dog itself,” he said.

Meechan will be sentenced in April.