Judaism teaches that there are three kinds of wars which have to be fought:
1. milchemet mitzvah (war commanded by G-d). Two such wars are described in the Hebrew Bible: the campaign against Amalek, and Joshua and the Israelites fighting for the Promised Land. The conditions are that the enemy has attacked first or that there is a need to pre-empt an attack;
2. milchemet reshut (optional war). The war must be a last resort, non-violent solutions must have been tried first, civilians must not be targeted and damage must be limited. No war such as this has been called since the fall of the Temple in 70 CE;
3. a pre-emptive war: this may only be fought when an attack upon Israel is imminent. This occurred in 1967, when Israel attacked the airfields of Egypt and Syria in the Six Day War in an attempt to prevent a long and bloody siege.
Jews must protect themselves and other Jews, as well as going to the aid of other countries to prevent war. Self-defence is also permissible:
If a person intends to kill you, be first to kill him (Talmud).