Muhammad bin Ammar bin Yasir (may Allah have mercy on him) said: The polytheists seized Sayyiduna Ammar bin Yasir (may Allah be pleased with him) and did not let him go until he spoke ill of the Prophet (peace and blessings be upon him) and spoke well of their gods. When he came to the Prophet (peace and blessings be upon him), he (peace and blessings be upon him) asked: "What happened?" He said: Something very bad; they did not let me go until I spoke ill of you (peace and blessings be upon you) and spoke well of their gods. He (peace and blessings be upon him) said: "How was your heart?" He said: At rest with faith. He (peace and blessings be upon him) said: "If they do it again, then you do it too."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب المرتد / 16896