What Comes First, Arvit or Hanukkah Lighting?

According to the Shulhan Aruch (Orah Haim 672:1), one should light the Hanukkah candles at the end of sunset, which practically speaking, is Tzet HaKochavim. Furthermore, the ideal lighting time extends for thirty minutes starting at Tzet HaKochavim. Rabbi David Ovadia (Nahagu Ha’am) and Rabbi Raphael Ankawa (Pa’amone Zahav) write that the Moroccan custom is to first pray Arvit and then to light the candles. Furthermore, they explain that it is preferable to advance the Arvit prayer so that the candles may be lit at their ideal time, rather than praying Arvit at its regular time and missing the thirty-minute window after Tzet HaKochavim for candle lighting. Interestingly, the Jews in Morocco would use the Maghreb call to prayer (Maghreb is the Muslim prayer which takes place around Ben HaShemashot) as a guideline of the approaching Hannukah lighting time.

Additionally, there is a principle of “Tadir VeShe’eno Tadir, Tadir Kodem”, which means that if one must perform two Mitzvot, the Mitzva that occurs more frequently should be done first. Since Arvit is recited every night of the year, it should be recited first, and then the less frequent Mitzva of Hanukkah should follow. Regarding this principle, the HIDA (Mahzik Beracha) says that if one would need to pray Arvit later so that the candles could be lit at their proper time, then one should do so, even though Arvit is a more frequent Mitzva. Conversely, if Arvit is recited early enough that one will be able to light the candles on time, then this is ideal.

Summary:  The custom is to first pray Arvit and then light the Hanukkah candles. If one will miss the thirty-minute window after Tzet HaKochavim because of Arvit, it is preferable to pray after lighting.