This Shabbat Parasha contains the commandments concerning warfare..
http://neshamaart.com/Newsletter/Torah/New/D%27varim/Shoftim/Midrash.htm
B"H SHOFTIM
Talmudic Sources
How a Jewish Army is Organized for War
In a war commanded by Hashem it is a mitzvah for each individual soldier not to be afraid of the enemy’s strength of numbers.
"When you go to war against your enemy and see a horse and a wagon, people more numerous than you, do not be afraid...." (20:21).It says "a horse and a wagon," in the singular, to imply a Divine promise: "When the Jewish people fulfill My Will, all the enemies' horses and wagons (or other military equipment) will be like one before Me. You are superior to the enemies in good deeds, and you are descendants of the forefathers, to whom I swore to multiply their seed.
"Just as I brought you out of Egypt with miracles, so can I perform miracles at any time of need."
Thus, after Bnai Yisrael crossed the Red Sea, they sang, "The horse and its rider He cast into the sea." Even though Pharaoh pursued the Jews with a large army, they were before G-d merely like one horse and one wagon.
Even though G-d does not want the Jewish people to rely on miracles, and therefore an army must be organized, a Jewish soldier is nevertheless forbidden to put his trust in the Jewish army, as it says (Tehillim 147:9-10), "He (G-d) does not want (one who trusts in) the horse's strength nor in the (swiftness of) man's legs. Hashem wants those who fear Him; those who hope for His kindness (who trust in His might rather than in human strength)."
During the battle a soldier may not think about his wife and children. He should bear in mind that victory or defeat is in G-d's hands. He has to do battle solely for Hashem's sake, and bear in mind that if he flees he will discourage others, and be held responsible for their retreat also. (According to Rambam (Hilchos Melachim 7:15), "One who fights wholeheartedly without fear and intends only to sanctify Hashem's Name is assured that no evil will come upon him and no harm will befall him." Nevertheless, Birkas Peretz comments that a soldier must be prepared to lose his life, since his thoughts may not be perfect and "Satan accuses at a critical time.")
The Torah commands the appointment of a special kohain, known as the mashuach milchama (the "kohain anointed for war," because he was consecrated with the oil of anointment), to teach the people the Torah commandments concerning warfare and to encourage them.
The kohain anointed for war addressed the people twice. The first time, at the border, before the army was mobilized, he read the verses:
"Any man belonging to one of the following categories may not take part in the war, but must leave the front:
Someone who recently built (or bought or inherited) a new home, and has not yet dedicated it by affixing a mezuza to the doorpost (that is, he has not yet lived in the house).
One who planted (or bought or inherited) a vineyard and the fourth year, in which its fruits are redeemed, has not yet arrived, so that he has never personally benefited from it.
One who betrothed a woman but has not yet married her."
The kohain's words are repeated by an officer, who adds:
"Whoever is faint-hearted and trembles at the sight of a drawn sword shall also return home."
All who withdrew had to prove the validity of their claim, with the exception of the faint-hearted. Those who left were required to perform support duties in the rear: clearing the roads, supplying the soldiers with food, and so on.
Why does the Torah disqualify the aforementioned groups of men from actual combat?
1. On a simple level, none of these men would make good soldiers, for their hearts would not be in the battle. The home owner dreams about the house in which he will never live if he dies in battle; the bridegroom about his marriage that may never take place, and so on. These groups will be quick to flee from the battlefield.
2. One of our Sages explains that "the fearful and faint-hearted" refers to one who is conscious that he has committed sins and is afraid that as a punishment he may fall in battle.
In order to spare the sinner the public shame of having to withdraw for this reason, G-d commanded that other groups - those who built a home, who planted a vineyard, who were betrothed and unmarried - also leave.
After commanding the judge Gidon to battle against Midyan, Hashem told him, "The people with you are too many for Me to deliver Midyan into their hands, lest the Jews pride themselves, saying, 'My hand has saved me.' Therefore, proclaim to the people: 'Whoever is fearful and trembling, let him return. (During the era of the judges, the Torah laws concerning selection of the soldiers did not apply. These laws are only in force under the ruling of the Jewish kings. Nevertheless, G-d commanded Gidon to dismiss the fearful.) He should leave Mt. Gilad early in the morning (at the time when people are still asleep, to spare him from shame!"
22,000 of the people returned, and 10,000 remained.
Hashem then said to Gidon, "The people are yet too many bring them down to the water and l will screen them for you there!"
After Gidon led the people to the water, G-d instructed him, "Assemble to you all those who lie down flat and lap the water like dogs, and put aside those who go down on their knees to drink."
Gidon divided the people - onIy three hundred had lapped the water Iying prostrate; all the rest had kneeled.
The Almighty then revealed to Gidon, "I will bring the victory through these three hundred men. (These are the tzaddikim; the rest kneeled down to drink because they are in the habit of kneeling before idols.)
G-d assists Jewish soldiers only if they are righteous. The Torah later warns that the army must maintain the highest levels of holiness, or else the shechina will depart.
After the army was organized and ready to fight, the kohain anointed for war addressed the people once again. His exhortation was repeated by another kohain.
He proclaimed in lashon hakodesh the verses:
"Shema Yisrael/Listen Yisrael! Today you are approaching war against your enemies. Let not your heart be faint; do not fear; do not tremble; and do not be terrified of them. For it is Hashem, your G-d, Who goes to fight with you (His holy ark, on which the shechina rests, is in your midst) against your enemies, to deliver you."
The prefatory "Shema Yisrael" implied: "If you have only the one merit of reciting the Shema every morning and night you deserve to be saved."
Why does recital of the Shema constitute such a great merit?
It is the most fundamental act of faith, whereby a Jew accepts G-d's authority upon himself.
Even the gentiles of old realized that the Jews were protected in the merit of reciting the Shema:
The Philistine giant Golias arrogantly and blasphemously challenged the Jews to appoint a champion to duel him. He would issue these challenges twice daily, in the mornings and at night, hoping that the Jews would assemble to listen and thereby forget the mitzva of reciting the Shema.
The kohain anointed for war encouraged the Jews with four expressions not to be afraid of the enemy, in order to counteract the four types of scare tactics employed by gentile armies:
1. They would clash their shields together to produce a thunderous metallic clanging sound.
2. They stamped their horses wildly and made them neigh.
3. They sounded their horns and trumpets.
4. They emitted loud, terrifying war cries.
Since these tactics usually caused fear and confusion among the enemy, the kohain warned the Jews:
1. Let not your hearts be faint (because of their horses' neighing).
2. Do not fear (their shields' clanging).
3. Do not tremble (upon hearing the trumpet blasts).
4. Do not be terrified (because of their war chants).
A military officer added the following proclamation which another officer repeated: "Who is afraid and faint-hearted? Let him return to his home, lest he make his brothers' hearts melt like his"
When Avraham heard that his nephew Lot was captured, he prepared his army for war according to Torah instructions.
Avraham called out before the battle: "Who is afraid of sins or evil deeds he has committed? Let him return home!"
[Rabbi Moshe Weissman, The Midrash Says, The narrative of the weekly Torah-portion in the perspective of our Sages Selected and adapted from the Talmud and Midrash, The Book of Devarim, p.234]
SHOFTIM
TALMUDIC SOURCES
The Mitzva to Appoint a Jewish King
After settling in the Land, the Jewish people are commanded three mitzvos:
1. To appoint a Jewish King, who will be chosen by G-d's prophet and by the Sanhedrin (Rabbinical Court).
2. To destroy Amalek.
3. To build the Bais Hamikdash.
When the prophet Shmuel grew old, the Jews approached him and demanded, "You have aged and your sons don't follow in your ways. Give us a king to judge us like all the nations!"
Shmuel was exceedingly aggravated by their request and prayed to Hashem. G-d confirmed that the Jews had done wrong, but nevertheless told him, "Fulfill their request! Know that they have not rejected you but Me!"
Shmuel explained to the people that the king would be entitled to a 10% tax from their produce and animals, that he woud hire anyone he wished for his services, and that he would impose other hardships on them.
However, the people insisted. By G-d's order, Shmuel then anointed the first Jewish king, Shaul ben Kish.
The question arises why Shmuel and Hashem considered the people's request evil, since the Torah commands the appointment of a Jewish king.
There may be several answers to the query:
1. Their request was premature. As long as Shmuel was alive, G-d performed open miracles for Bnai Yisrael. Requesting another leader during Shmuel's lifetime constituted a rejection of the supernatural way of life they enjoyed.
2. The people's request was not for the sake of fulfilling the mitzva, but sprang from a desire to be ruled in a manner similar to the gentile nations around them.
Until Shmuel's time the Pelishtim, neighbors of the Jews, had been ruled by noblemen. However, during the period coinciding with Shmuel's government they began to appoint kings. Thus, by asking for a king, the Jews were actually imitating the Pelishtim and the other gentiles; they did not have the Torah commandments in mind.
3. According to a view of our Sages, only the unlearned among the Jews asked with sinful intentions, while the Elders requested a king solely for the sake of fulfilling the mitzva. Shmuel's anger was directed at those who had unworthy motives.
What is the proper role of a Jewish monarch?
His task is to lead the nation; to fortify and elevate the Torah so that the Jewish people are fully governed by halacha (Jewish code); to spread righteousness and justice in the world; to subdue the wicked; to wage the wars of Hashem; and to judge the Jewish people. He is meant to hold his position leshaim shamayim - performing all his functions for Hashem's sake.
[Rabbe Moshe Weissman, The Midrash Says, The Book of Devarim, p.214-215]