النبي (صلى الله عليه وسلم) remained at عرفة until after the sun had completely set, and then he departed for مزدلفة. This أُسس the السنة of remaining at عرفة until sunset. The scholars differ on the ruling for a الحاج who departs before sunset and whether a penalty is required.
The Hanbali school, followed by ابن باز and ابن عثيمين, holds that remaining at عرفة until sunset is واجب (واجب), and leaving before sunset without returning requires a dam (sacrifice of a sheep). Their evidence is that النبي consistently remained until sunset and said: 'Take your rites from me.' If the الحاج returns to عرفة before sunset — even briefly — no penalty is due. الشيخ ابن باز emphasized that النبي's practice of staying until sunset is binding, not merely مستحب.
The Hanafi school considers remaining until sunset واجب as well, and requires a dam for leaving early. The Maliki school holds a similar position. The Shafi'i school, however, considers remaining until sunset as السنة mu'akkadah (emphasized السنة) rather than واجب, meaning it is highly مستحب but no dam is required for leaving early — only the loss of the السنة's reward. All scholars agree that the wuquf (standing) itself is valid even if the الحاج left before sunset, as long as they were present at عرفة at some point after zawal. The الحج is not invalidated by early departure.