On Saturday night: what comes first, havdalah or lighting the Hanukkah candles?

Question: When Saturday night falls during Hanukkah, do we first make havdalah or light the candles?

Answer:

The Ben Ish Chai distinguishes between the synagogue and a private home.

In the synagogue:

First the Hanukkah candles are lit, and afterward havdalah is made.

At home:

First havdalah is made, and afterward the Hanukkah candles are lit.

The Ben Ish Chai writes that this order is the more correct one.