I always believed that I’tikaf is a Sunnah but I am told that in certain situations it becomes a duty. Could you please comment?

The I’tikaf is a practice that means devoting one’s time to worship in a mosque. It can be a Sunnah and it can be a duty. It is a duty only when a person pledges to God to do it in a specific way or for a specific time. Like every such pledge, it must be honored. Otherwise, it is a Sunnah, particularly in the last ten days of Ramadhan. The Prophet, peace be upon him, did this Sunnah more than once, but there is no authentic Hadith to speak of its importance. If it is not pledged, it can be terminated at any time. It does not have to be in Ramadhan.

In fact, it can be at any time a person is staying in a mosque. He may make his intention clear by saying: “I will be in I’tikaf in this mosque for as long as I am here.” This means that he has to dedicate his time to worship during his presence in the mosque.

The I’tikaf can be done in any mosque. If one makes the intention to do it in a particular mosque, he can change location, provided he moves to another mosque. Only if he specifies the Haram in Makkah, the Prophet’s Mosque in Madinah or the Aqsa Mosque in Jerusalem, he must do it in the one he specifies.