نبی کریم (صلی اللہ علیہ وسلم) remained at عرفات until after the sun had completely set, and then he departed for مزدلفہ. This established the Sunnah 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 Ibn Baz and Ibn Uthaymeen, holds that remaining at عرفات until sunset is wajib (واجب), 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. Sheikh Ibn Baz emphasized that نبی کریم's practice of staying until sunset is binding, not merely مستحب.
The Hanafi school considers remaining until sunset wajib 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 Sunnah mu'akkadah (emphasized Sunnah) rather than wajib, meaning it is highly مستحب but no dam is required for leaving early — only the loss of the Sunnah'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.