As we have seen, in the time of the Sages people generally returned home at nightfall. Therefore, the Sages stated that the mitzva to light Ĥanuka candles extends “from sunset until the marketplace empties out.” The expression “until the marketplace empties out” refers to the time when the poor people who would collect leftover food from the market stalls would return to their homes (Shabbat 21b). This was about half an hour after lighting time (Rif).
Nowadays, when there is electric lighting and most people continue working for several hours after dark, the best time to light is still the time that the Sages ordained – from tzeit until half an hour afterward. However, if one finds it difficult to return home by tzeit, he may light later. One should try to return home as soon as possible, in order to light close to the ideal time ordained by the Sages. Specifically, one should make an effort not to light later than 9 pm. Until then, it is standard for people to come home from work, so this period of the evening is still considered “until the marketplace empties out” (see n. 13 below). One should make sure not to eat a meal, meaning a keveitza of bread or mezonot, until after lighting (mb 672:10 and 431:6; above 12:13).
In some synagogues, a regular Torah class takes place following Ma’ariv, and if people leave to light candles after Ma’ariv, the class will be canceled. In such a case, it is preferable to hold the class as usual, and the attendees should light Ĥanuka candles afterward, because the mitzva of Torah study takes precedence over the value of lighting candles at the ideal time (see n. 13).