a condition before your Lord to the extent that you have stipulated it.” (1) From this it is understood that if a person enters into an act of worship and stipulates something that does not conflict with that worship, there is no harm in it.
If it is asked: Does analogy not apply in acts of worship?
The answer is that what the scholars mean when they say, “There is no analogy in acts of worship,” is that analogy cannot be used to establish an independent act of worship. As for conditions within an act of worship and similar matters, there is no harm in applying analogy when the two acts of worship are alike in meaning. The scholars have always employed this, as when they say that pronouncing the name of Allah is obligatory in ghusl and tayammum by analogy with wudu. There is no consequential difference between a person in ihram who fears an impediment and a person observing i‘tikaf who fears an impediment.
Question: If someone begins voluntary i‘tikaf and then his father dies or becomes ill, may he discontinue it?
The answer is that he may discontinue it, because continuing his i‘tikaf is a sunnah, whereas visiting his father or a close relative may be obligatory, as it is part of maintaining family ties. The same applies to attending his funeral.
Supplement: There remains a third category of the person observing i‘tikaf leaving his place of retreat: leaving for something he can do without and which serves no legislated purpose. This invalidates his i‘tikaf, whether he stipulated it or not—for example, leaving to buy and sell, to go on outings, to be intimate with his wife, and the like.