The 190th mitzvah is that we are commanded regarding the way1 to wage war against other nations [besides Amalek and the seven nations]. Such a war is called a milchemes reshus2 [optional war]. We are commanded that in the event of war, we should offer to make peace with them only as far as not killing them. If they surrender and give us the land, we then place upon them duty and servitude.3

The source of this commandment is G‑d's statement4 (exalted be He), "[When you approach a city to wage war against it, you must propose a peaceful settlement. If the city responds peacefully and opens its gates to you,] all the people inside shall pay you duty and serve you."

The Sifri5 says, "If they [the enemy] say, 'We accept duty but not servitude,' or 'servitude but not duty,' we do not accept; only when they accept both." [The "duty"6 is] to pay a fixed amount every year, as set by the king of that time, and the "servitude" is to obey all commands and to be constantly in fear and humbled.

But if they do not surrender, we are commanded to kill all male inhabitants of the city, both high and low in status,7 and to capture all the booty and the women. This is commanded in G‑d's statement8 (exalted be He), "If they reject your peace offer [ shall strike down its males by the sword. However, the women, children, animals and all the goods in the city, you shall take as your spoils]." All these laws are included under the commandment of milchemes reshus.

The details of this mitzvah are explained in the second chapter of tractate Sanhedrin9 and the eighth chapter of tractate Sotah.10