All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, is His slave and Messenger.
Devoting an act of worship to an idol, such as making Tawaaf (circumambulation) around it or prostrating to it, entails ruling its doer a disbeliever, even if he has done so in jest, as stated by Muslim jurists.
Al-Mawsoo‘ah Al-Fiqhiyyah Al-Kuwaytiyyah (Kuwaiti Fiqh Encyclopedia) states:
“Muslim Jurists unanimously agreed that prostrating to an idol, the sun, or to any created being is an act of disbelief that takes the doer out of the fold of Islam as long as he is a sane adult who did it willfully, whether it is done deliberately or in jest.
The Shaafi‘i scholars stated that if he did not prostrate to an idol or to the sun out of veneration and belief in their divinity but rather did so while his heart is reassured with faith in Allah, then the relevant ruling on the disbelievers applies to him in the worldly life, based upon the outward behavior, but he is not judged as a disbeliever with regards to what is between him and Allah. If there is strong evidence indicating that his action was not done out of irreverence (to Allah, The Almighty), like the case when a prisoner of war prostrates (to an idol or a human) in a belligerent non-Muslim land in the presence of a disbeliever, out of fear, he is not judged as a disbeliever.” [End of quote]
Allah Knows best.