She said she accepted that the crime was not the result of prejudice against the Ahmadi community but that it was religiously motivated, adding: "It's clear you are proud of what you did. You seem oblivious to the fact that you have devastated a family."
The court heard the killer, a Sunni Muslim, was offended by Shah's Facebook posts, in which he thought the shopkeeper was claiming to be a prophet.
Shah was stabbed up to 30 times and had his head and face repeatedly stamped on after publishing hundreds of videos about his spiritual beliefs online.
Rae told Ahmed: " This was a barbaric, premeditated and wholly unjustified killing of a much loved man who was a pillar of the local community.
"He was described as a peaceful and peace-loving man and family man who went out of his way to show respect for those of any faith."
She branded the attack "an appalling display of merciless violence" as Ahmed ignored the pleas from Shah's brother to stop.
She added: "No one in any civilised country, including Scotland, has the right to take the life of another, whatever offence that individual perceives that he or she has suffered.
"It is vitally important in modern society that respect and tolerance for others of any race, creed, colour, ethnic origin or religious belief is maintained and protected by the law of the land." The judge also said she noted with "considerable concern" that Ahmed had expressed no remorse.
The killer shouted to his family and friends in the public gallery as he was led from the dock, saying: "Praise for the Prophet Muhammad, there is only one Prophet." Some of his supporters responded by raising their arms and repeating the phrase.
On March 24, Ahmed watched a video of Shah on his mobile phone and left a message for an acquaintance saying: "Listen to this guy, something needs to be done, it needs nipped in the bud."
The peace-loving Ahmadi Muslim community promotes "love for all, hatred for none". Ahmadi Muslims are persecuted in many parts of the world and Shah's extended family fled from Pakistan to Scotland in 1991 because of their faith. Shah joined his family in Scotland in 1998 and was granted asylum.
The court was told last month that Ahmadis differ from the majority of Muslims in that they do not hold that Muhammad is the final Prophet.
In a harrowing witness statement, Shah's family said last month that they had decided to leave Scotland because they could not cope with their "pain and fear".
Shah's father and mother, Syed and Sadiqua, his wife Khalida and his six brothers and sisters said they never thought they would be in danger in Scotland but now feel "imprisoned by our pain and suffering" and unable to live a normal life.
They said the murder had left them struggling with "simple things" like being in public places or communicating with friends and that Shah's wife now leads "a life of isolation and solitude".
Shah had wished Christians a Happy Easter on social media hours before his death but the court was told the comment had no bearing on the crime.
In a later statement, Ahmed, a father-of-three, said Shah had "disrespected the prophet of Islam, the messenger of Allah, Prophet Muhammad, peace be upon him," adding, "If I had not done this others would have and there would be more killings and violence in the world.
"I wish to make it clear that the incident was nothing at all to do with Christianity or any other religious beliefs. Even although I am a follower of Prophet Muhammad, peace be upon him, I also love and respect Jesus Christ."
Rae told Ahmed he was guilty of a "truly despicable crime" that was motivated by his "sense of offence at a man's expression of his religious beliefs, which differ from yours".