Positive commandment · Mitzvat Aseh #186 of 613
To slay the inhabitants of an apostate city and burn the city
להרוג אנשי עיר הנידחת ולשרוף את העיר
The verse · Devarim 13:17
וְאֶת־כׇּל־שְׁלָלָהּ תִּקְבֹּץ אֶל־תּוֹךְ רְחֹבָהּ וְשָׂרַפְתָּ בָאֵשׁ אֶת־הָעִיר וְאֶת־כׇּל־שְׁלָלָהּ כָּלִיל לַה׳ אֱלֹהֶיךָ וְהָיְתָה תֵּל עוֹלָם לֹא תִבָּנֶה עוֹד
“And thou shalt gather all the spoil of it into the midst of the open place of the city, and shalt burn with fire both the city and the entire plunder taken in it, for the Lord thy God: and it shall be a heap for ever; it shall not be built again.”
The Rambam’s words
To slay the inhabitants of an apostate city and burn the city, as [Deuteronomy 13:17] states: "And you shall burn the city and all its spoil with fire."
להרוג אנשי עיר הנידחת ולשרוף את העיר, שנאמר: "ושרפת באש את . . . כל שללה" (דברים יג,יז).
Why · Sefer HaChinuch #464
The burning of an enticed city and to kill its people
“The root of this commandment is well-known — that evil and sinful men like this that agreed [upon] a bad and disgusting agreement like this together are fit to have their name erased and their memory destroyed from the world, and that there should not be a place of their remembrance in the world at all.”
Who & when
“And this commandment is practiced by males — as justice is theirs — and at the time that Israel is on its Land and that the Great Court of seventy-one [judges] is in its place, since we only judge an enticed city through the Great Court.”
Where in the Mishneh Torah
Hilchot Foreign Worship and Customs of the Nations הלכות עבודה זרה וחוקות הגויים