In recent times, especially in the wake of Churban Europe in the WWII period, a hotly debated topic has been whether it is proper for a leader, esp. a spiritual leader such as a Rav or Rebbe, to leave his kehillah in time of danger.
Interesting historical perspective can be gleaned from what I recently read in הישיבה הרמה בפיורדא, חלק ב.
In the chapter on Rav Chaim Zvi Hirsch Berlin, it is related (p.83) that during the Napoleonic wars, when he was Rav and Rosh Yeshiva in מגנצא (Mainz), the heads of the Mainz kehillah, in concern for his safety, spirited him away to Frankfurt.
רבש”ה then cites the words of the חתם סופר discussing this question (bottom of right column in Chasam Sofer).
The Chasam Sofer says that he he heard that when Prague was under siege some sixty years earlier, the Noda biYehudah (NBY), R. Yechezkel Landau, wanted to escape, but the leaders did not allow him to do so. He continues, that the NBY’s wanting to leave was understandable, as we know that one should not stay in a place of danger (סכנה), so that ones זכויות not be diminished (at least, if not for other reason as well). The leaders not allowing him to leave is also understandable, as they wanted their shield (the great Rav and tzaddik) with them, and so it is fitting for a leader of Yisroel, to give himself for his nation….and not leave them in danger and save himself alone.
However, he continues, many dispute this, as when Mainz was besieged a number of years ago, they sent their Rav, the Gaon Rav Chaim Harsch זצ”ל to Frankfurt, and so did the leaders of Koblenz with their Rav….as Frankfurt sent my teacher the הפלאה…(elsewhere)….as even (after being moved for safety) elsewhere (these great leaders) could daven for the kehillah and protect them as possible…so why do they need to suffer….So what emerges from this, is that there is a machlokes between the leaders of the kehillah of Prague and the other kehillos mentioned.
Interestingly, רבש”ה in the footnotes states that a friend of his brought to his attention the words of the son of the NBY (toward the bottom of the right column, ד”ה רחב לבב), who wrote that in 5517 (1756 or 1757 7 C.E.), when the city was in danger, the NBY, in contrast with many of the notables, did not leave his flock, not exactly what it reported above. As an aside, it is not clear (at least to me) if both accounts are describing the same situation, or if they pertain to different episodes.
Anyway, it seems that the חתם סופר comes down on the side of the מנהיג staying with the ציבור. However, it is not phrased as absolutely unequivocal halachic pesak, rather he uses terminology such as ראוי and נראה יותר הגון. One should also keep in mind that it appears in דרשות חת”ס and not שו”ת חת”ס.
Anyway, since no two situations are exactly the same, perhaps each case needs a separate pesak.
והשי”ת ירחם עלנו ויגן עלנו ממקרים כאלו, אכי”ר