Bamidbar 31:7 – They mounted an attack against Midian, as the Lord had commanded Moses, and they killed every male.
Sifri – they surrounded [Midian] on all four sides [this is the general opinion]; Rabbi Natan’s opinion is that the Israelites [surrounded Midian on three sides and] left a fourth side open so that [anyone who wanted to] could flee
Torah Temimah Colloquial Translation on Note #9:
That is to say that [according to the opinion of Rabbi Natan] the Israelites left a place so that anyone who wanted to flee, could [in fact] flee. The Rambam is the six chapter of the laws of kings, in halacha seven, writes as follows: “when you siege a city to capture it, don’t surround it [completely] on all four sides, rather surround it on three sides. Leave a place for escape, so that anyone who wants to flee to save his life can do so. This is according to the oral tradition that thus it was commanded as it says in the verse ‘they mounted an attack against Midian, as the Lord had commanded Moses…”
The Kesef Mishna in his commentary on the Rambam cites the above mentioned Sifri as the the source for the Rambam’s ruling. To me, however, this is astounding.
It is not clear why the Rambam decided according to the opinion of Rabbi Natan against the general opinion. Also Rambam phraseology is not clear when he states “this is according to the oral tradition that thus it was commanded.” Where is this command [of only surrounding on three sides] alluded to? Further, what is the source of Rabbi Natan’s opinion?
It is possible to say that the Rambam was relying on what it says in the Jerusalem Talmud Mesechta Shviis, Chapter 6, Halacha 1. There is says that Joshua sent 3 public pronouncements prior to entering the Land of Israel. One of the pronouncements was that anyone who wanted to flee, was free to do so. So, apparently, it is unclear where Joshua was instructed to do this. One needs to conclude that Joshua learned to do this from [watching] the way Moshe conducted his wars. So, behold this is a proof to the opinion of Rabbi Natan. It is on this beraita [in the Jerusalem Talmud] that Rabbi Natan relied on for his opinion. Also, as it is known that an unattributed beraita is according to Rabbi Natan, it is therefore logical that the Rambam would decide according to Rabbi Natan.
This also explains the Rambam’s phraseology of “according to the oral tradition we learn”. The intent is that according to the way that Joshua conducted himself, we see that thus it was commanded to Moshe.
The reason for leaving the fourth side open is because if one does not do this, the fighters would fight without hope with their last remaining ounce of strength. It would then be more difficult for the Children of Israel to win the war. This would not be the case if a fourth side were left open for the combatants to flee.