A judge has ordered the home secretary to reconsider granting asylum to two Ahmadi Muslims who fear persecution in their native Pakistan.

Lord Glennie ruled on Tuesday that the mother and son, who have not been named, should be allowed to make a fresh claim to remain in the United Kingdom.

The judge, who was sitting at the Court of Session in Edinburgh, said that their religious beliefs could place them in danger of falling victim to violence if they are returned home.

The pair, who reside in Glasgow, belong to a minority sect of Islam which some Muslims consider to preach heretical beliefs.

The peace-loving Ahmadi Muslim community actively promotes "love for all, hatred for none".

Earlier this year, shopkeeper Asad Shah, 40, was murdered outside his store in Shawlands, Glasgow. Mr Shah was a member of the persecuted Ahmadi sect of Islam and was killed by a Sunni Muslim.

The pair in the current case had previously been denied the right to remain in Britain after immigration judges ruled that they did not qualify for asylum.

In September 2015, lawyers acting for the mother and son made further submissions to the Home Office. The new submissions were based on official guidance which had been adopted by the UK government in light of the changing political situation in Pakistan for Ahmadi Muslims.

Lawyers said their new submissions should be treated as a fresh application for asylum. However, Theresa May refused to consider the submissions as a new application for asylum and ordered them to be removed from Britain.

On Tuesday, Lord Glennie ruled that the Home Office failed to take into account the new official guidance about dealing with asylum claims made by Ahmadi Muslims.

The guidance states that people belonging to the group face being persecuted for their faith. It states that the risk of danger to members of the sect has increased in recent years.

Lord Glennie wrote that the home secretary Amer Rudd now needs to reconsider the family's request for asylum. He added: "There has been a marked and significant change in the country guidance dealing with the position of Ahmadis in Pakistan.

"Instead of it being the case that there is a very low risk of persecution, the new country guidance makes it clear that it is now dangerous for an Ahmadi to practice and manifest his or her faith openly in Pakistan.

"For these reasons, I shall grant the prayer of the petition and reduce the decisions that the petitioners's have not made fresh claims for asylum."

The Ahmadi is an Islamic religious movement founded near the end of the 19th century. They believe that another prophet succeeded Muhammad.

The majority of Muslims believe Muhammed was the last and final prophet and anything other than this is blasphemy.

Earlier this month, Tanveer Ahmed, 32, pleaded guilty to murdering Glasgow shopkeeper Asad Shah. He brutally stabbed, punched and stamped on his victim during the prolonged and murderous attack which shocked the community and Scotland as a whole.

In the judgment issued on Tuesday, Lord Glennie tells of how the mother and son, who is aged 27, arrived in the UK and claimed asylum in 2007. Their claim was denied in 2009.

Official guidance at that point in time showed that Ahmadi Muslims faced little persecution in Pakistan. However, new guidance changed the position to take into account new political developments in Pakistan affecting Ahmadi Muslims.

In recent years, according to the judgment, Ahmadi Mosques in Lahore came under attack. Ahmadi Muslims can also be prosecuted for blasphemy.

On the basis of these developments, lawyers acting for the mother and son made new submissions in September 2015. However, the then home secretary Theresa May concluded that there wasn't enough evidence to prove that they would be persecuted if they were returned to Pakistan.

Lord Glennie concluded that the Home Office should have considered the official guidance for Pakistan when making their decision.

He added: "That is not to say, of course, that the Secretary of State was bound to find in favour of the petitioners's claims for asylum or to conclude that the new material was of any particular weight in support of their claims.

"But she was bound to consider it carefully, with anxious scrutiny, and for the reasons given above, I am not satisfied that she did so."