"They shall be your subjects and shall serve you"Deuteronomy 20:11.

When embarking upon an "optional war" [for the sake of expanding the borders of Israel, as opposed to the "mitzvah wars" waged against Amalek and the Seven Canaanite Nations], we are commanded to first offer the opponent a peace settlement. If the opponent accepts the terms of the peace proposal – i.e., the nation accepts upon itself Jewish sovereignty and agrees to pay an annual tax to the Jewish monarch – then we do not wage battle against them.

If they do not accept the terms of the peace proposal, then we go to battle and kill the male population, and the women and property are taken as spoils.

[With regards to "mitzvah wars," we also first offer a peace proposal, but in the event that the enemy doesn't accept the terms, then the entire population – male and female – are not allowed to live.]