There are 13 countries that impose capital punishment for apostasy and blasphemy.
All 13 countries, scattered in the Middle East, North Africa and Southeast Asia, are dominated by Muslims where the Quran is the primary and supreme source of jurisprudence, according to International Humanist and Ethical Union in its 2016 Freedom of Thought report.
The law is based on the Quran's teaching that Muslims are to make war upon a person who leaves Islam.
The 13 countries where it is prohibited to renounce Islam are Afghanistan, Iran, Malaysia, Maldives, Mauritania, Nigeria, Pakistan, Qatar, Saudi Arabia, Somalia, Sudan, United Arab Emirates and Yemen. With the exception of Pakistan, apostasy is punishable in these countries by death.
According to the Law Library of Congress, apostasy can be used in charging individuals for their comments made on social media, which has happened in Mauritania, Saudi Arabia and Yemen. During a trial, an accused is given the chance to denounce their new faith and turn back to Islam.
In Iran, Shari'a law is used as the basis for prosecution according to the opinions of religious leaders. The Library also noted that those accused not only face criminal prosecution but also the risk of being killed extrajudicially, particularly in Iran and Mauritania.
While apostasy doesn't warrant a death sentence in Pakistan, there is widespread intolerance for blasphemy and disbelief in God. This makes atheists and humanists unsafe there, but human rights groups say Christians are also often falsely accused of blasphemy because the blasphemy laws are wide open to misuse and authorities often turn a blind eye. In some instances, those accused of blasphemy are mobbed to death outside of the court without ever having a fair trial.
By contrast, Freedom of Thought cited the best-ranked countries or those with a "free and equal" rating as being Jamaica, Uruguay, Japan, Taiwan, and Belgium. These are the least discriminatory countries in treating its citizens with regards to their belief, ideology and religion.