Just before a Jewish army goes out to battle, the leaders announce that anyone who is afraid should return home, lest their anxiety spread to their fellow fighters.
The Sages of the Talmud debate the nature of the “fearful and fainthearted” addressed here. Some interpret this as reference to those who fear because of their sins —i.e., they recognize their shortcomings in Torah observance, and fear they are thus unworthy of G‑d’s protection during battle. According to this opinion, all who were simply fearful of the battle presumably returned home earlier, when the Kohen addressed the soldiers, saying: “Let your hearts not be faint; you shall not be afraid, and you shall not be alarmed...”
Rabbi Akiva, however, insists that this final announcement addresses those “who cannot stand in the closed ranks of battle and look upon a drawn sword.” As the battle draws nearer, even those who felt confident earlier might now be overcome with fear, and are encouraged (again) to return home.
Rabbi Akiva’s rejection of the alternative explanation indicates that those who “fear because of their sins” can in fact still go to war with confidence, and therefore do not pose any risk to the army’s morale.
What was Rabbi Akiva’s reasoning?
The Talmud states elsewhere that out of his immense love for his fellow Jews, Rabbi Akiva always sought angles from which the Jewish people would be judged favorably and meritoriously. Now, a person who “fears because of his sins” recognizes that his conduct was objectionable, believes that G‑d can and will hold him accountable, and hopes to be spared that Divine retribution. Thus, even if he lacks the inner strength to actually implement change in his behavior, he still regrets the sinful ways that brought him to this point, and in Rabbi Akiva’s view, this “contemplation of repentance” alone makes him worthy! Rabbi Akiva therefore held that he can go off to battle with confidence, assured of Divine protection and deliverance.
—Likkutei Sichos, vol. 9, pp. 128–129