TT #323 · Parashas Shoftim · Seventh Aliyah · Passuk 20:19
When you besiege a city for many days to fight against it to capture it, you shall not destroy its trees by swinging an axe against them, for from them you may eat, and you shall not cut them down; for is the tree of the field a man, to come before you in the siege?
Torah Temimah points to Sifrei Devarim 203 / Bava Kamma.
TT lemma: לֹא תַשְׁחִית אֶת עֵצָהּ.
Sefaria — Sifrei Devarim 203 / Bava Kamma
English: ‘You shall not destroy its trees’ – a prohibition against wanton destruction.
Derash establishing bal tashchit (Sifrei) — the verse forbids the needless destruction of fruit trees even in war.
Even during a prolonged siege it is forbidden to destroy the fruit trees of the city; one may eat from them but must not cut them down for destruction.