It is said that someone once told Abraham Lincoln that he hoped “the L‑rd is on our side of the war.” The president responded, "I am not at all concerned about that . . . But it is my constant anxiety and prayer that I and this nation should be on the L‑rd’s side.”

I believe that this reflects the Jewish attitude toward war. In an imperfect world, the Torah recognizes war as an unfortunate necessity. Ancient Israel had to defend itself, like any other nation. But the Torah also lays down guidelines to ensure that this horrible tool is used sparingly and compassionately.

As always, the Torah’s wisdom is timeless. Many of the laws governing warfare are as prescient today as they were three thousand years ago. Here is a sampling.

In general, the wars fought by the Jewish armies were divided into two categories: Milchemet mitzvah (obligatory war), a war that G‑d commands us to fight; and milchemet reshut (voluntary war).

A prime example of milchemet mitzvah would be the battles waged by Joshua to conquer the Land of Israel. All wars fought for the defense of Israel were also included in this category.

Voluntary wars, those deemed necessary by the nation’s leaders, could be fought only with the consent of the high court of 71 Torah sages.

In either case, the Jewish armies were forbidden to initiate a war without first attempting to offer the enemy peace. The terms of the settlement included their keeping the Seven Noahide Commandments and paying monetary tribute to Israel.

When besieging a city, we are enjoined not to encircle the entire city. Rather, one side must remain open, allowing all those who wish to flee to do so. Neither may we cut down fruit trees outside the city, or stuff up the water supply. (This applies in times of peace of well. In fact, the sages derive the prohibition against wantonly destroying natural resources, known as bal tashchit, from these laws.)

Even in times of war, we must retain human dignity and hygienic standards. To this end, Israelite soldiers carried a spike with them to bury their waste.

The Jewish armies were led out to war by a special kohen (priest), known as the mashuach milchamah (the one anointed for war), who was designated for this task. He would encourage the soldiers to fight bravely, telling them that G‑d was surely on their side.

He would also announce that anyone who had recently betrothed a woman but not married her, planted an orchard but not yet worked it, or built a new home but not yet moved in, should leave the battlefield and support the warriors from behind the lines.

(In a milchemet reshut, one who had married, moved into a new home or begun working a new orchard within the past year did not report to battle altogether. These people would, however, participate in a milchemet mitzvah.)

The kohen would also announce that anyone who was afraid should leave the front rather than dampen the morale of his comrades. When the kohen spoke of fear, he was not just speaking to those frightened by the dangers of battle. He was also talking to the person who knew that he had sinned against G‑d and might not be worthy of divine protection in a dangerous situation.

These laws, and the many others governing warfare, were designed to ensure that the Jews performed their role as a “light unto the nations,” a beacon of righteousness in a dark and immoral world. Of course, the Torah’s main objective is to achieve the purpose for which the world was created: the messianic era, when “they shall beat their swords into plowshares, and their spears into pruning hooks; nation shall not lift up sword against nation, neither shall they learn war anymore . . .” (Isaiah 2:4).

Many of these laws are derived from Deuteronomy 20 and other Torah sources. They are codified in Maimonides’ Mishneh Torah, Laws of Kings and their Wars.