Sayyiduna Ibn Abbas (may Allah be pleased with them both) said concerning the words of Allah Almighty: "Except one who is compelled while his heart is at rest with faith" [Surah al-Nahl: 106]: In it Allah Almighty has informed us that whoever changes his religion after Islam, upon him is the wrath of Allah and for him is a great punishment; but whoever is compelled and says something with his tongue only to save himself from them, there is no blame on him, because Allah Almighty holds (people) to account for what the servant does with his heart.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب المرتد / 16899