Switzerland has about the same population as Israel, with four distinct ethnicities, and is in a similarly vulnerable geographic location. It has been independent since 1291, except for a brief period of French occupation during the Napoleonic wars. It has not been involved in an international conflict since 1815, and its independence and neutrality were respected throughout World War I and World War II, which convulsed Europe for ten of the thirty-one years between 1914 and 1945.
How was this possible? Well, among other things it is a rich and relatively self-sufficient country with a highly-educated population. It also has a sizeable and efficient defense industry. Perhaps most importantly it is armed to the teeth, with extensive fortifications and an entirely conscript army–there are no exemptions, except for medical reasons. It has joined no military alliances and is not even a member of the European Union.