Deuteronomy 13:13-19 relates:
Should you hear [a report about] one of your cities which God, your Lord, is giving you to dwell within, stating: "Unfaithful people have emerged from your midst and they have led astray the inhabitants of their city, saying: 'Let us worship other gods about whom you are not aware,' you must investigate and probe, making careful inquiry. If it is true and correct that such a revolting thing has occurred in your midst, you must surely kill all the inhabitants of the city by the sword. Destroy it and everything in it. [Kill] all its animals by the sword.
Gather all its goods in the midst of its main street. Burn the city and all its goods entirely for the sake of God, your Lord. [The city] shall remain an eternal ruin, never to be rebuilt. Let nothing that has been condemned remain in your possession, so that God's fierce anger will be allayed and He will grant you mercy. He will deal mercifully with you and will make you flourish as He promised your fathers.
Our Sages refer to a city condemned for these reasons as an עיר הנדחת - literally, "a city that has been led astray." In Sefer HaMitzvot, the Rambam derives four of the 613 mitzvot of the Torah from the above passage:
Negative Commandment 15: Not to proselytize among the masses on behalf of false deities;
Positive Commandment 186: To burn an עיר הנדחת;
Negative Commandment 23: Never to rebuild an עיר הנדחת;
Negative Commandment 24: Not to benefit from its spoil.
There is a unique dimension to the laws of an עיר הנדחת that is not found in regard to any of the other prohibitions of the Torah. In this context, the city is considered as a single entity and the inhabitants and their property are not considered as individuals but as memers of this wicked collective (Tzaphnat Pane'ach, Likkutei Sichot, Vol. 9).
Sanhedrin 71a mentions a debate among the Sages. One maintained that the mitzvot concerning an עיר הנדחת were never actually fulfilled, and that the passage was instituted in the Torah only for the purpose of theoretical discussion. Another states explicitly: "I saw such a city and sat among its ruins." From Halachah 11 (see Note 50; see also Hilchot Melachim 11:2), it appears that the Rambam subscribes to the latter view.
This chapter deals only with the prohibition against proselytizing on behalf of a false deity to the majority of the members of a city. The prohibition against proselytizing to individuals for these purposes is mentioned in the following chapter.
Those who lead [the inhabitants of] a Jewish city astray are executed by stoning, even though they themselves did not worship a false deity, but [merely] proselytized to the inhabitants of their city until they worshiped it.
The inhabitants of the city that has been led astray (עיר הנדחת) are executed by decapitation if they worshiped a false deity or accepted it as a god.
What is the source that serves as a warning against proselytizing on behalf of a false deity? "Let not [the name of another deity] be heard through your mouth."
A city is not condemned as an עיר הנדחת until two or more individuals attempt to lead its inhabitants astray, as [Deuteronomy 13:14] states: "Unfaithful people have emerged...." The people who lead them astray must be from that tribe and from that city, as [the verse continues]: "from your midst."
Those led astray must be the majority [of the city's inhabitants]. They must number from [at least] 100 to the majority of the tribe. If, however, the majority of the tribe is led astray, they are judged as individuals, as implied by [the phrase in the following verse]: "the inhabitants of the city;" neither a small village nor a large metropolis. If there are fewer than 100, it is considered a small village. If the majority of the tribe is involved, it is considered to be a large metropolis.
Similarly, the laws applying to an עיר הנדחת are not enforced if:
the people who led them astray were women or minors,
they were led astray by a single individual,
a minority of the city were led astray,
they turned to idols on their own initiative, or
if those who led them astray came from outside the city.
Instead, [the violators] are considered to be individuals who worshiped false deities. All those who worshiped are executed by stoning, and their estate is given to their heirs like all others executed by a court.
The laws of an עיר הנדחת are enforced only by a court of 71 judges, as [implied by Deuteronomy 17:5]: "And you shall take the man or woman who did that wicked thing to your gates." [This can be interpreted to mean:] Individuals are executed by the courts which are found at the gates [of every city]. A multitude are only executed by the supreme court.
None of the cities of refuge can ever be condemned as an עיר הנדחת, as [implied by Deuteronomy 13:13]: "one of your cities." [Similarly,] Jerusalem can never be condemned as an עיר הנדחת, because it was not divided among the tribes.
A border city is never condemned as an עיר הנדחת, so that gentiles will not enter and destroy Eretz Yisrael. One court should not condemn three cities located next to each other as an עיר הנדחת. If [the cities] are separated from each other, they may condemn them.
[A city] is not condemned as an עיר הנדחת unless those who proselytize [the inhabitants] address them in the plural, telling them, "Let us go and worship," "Let us go and sacrifice," "Let us go and bring a burnt offering," "Let us go and offer a libation," "Let us go and bow down," or "Let us go and accept [the deity] as a god."
[The inhabitants] must listen and then worship [the deity] with its accepted mode of worship, or through one of the four modes of worship [mentioned in Chapter 3, Halachah 3], or accept it as a god.
What happens if all these conditions are not fulfilled with regard to a city or those who proselytize [its inhabitants]? Warnings are given to each person who worships false gods, and testimony [is delivered against them]. They are executed by stoning as individuals who worshiped false gods, and their estate is given to their heirs.
What is the judgment rendered against an עיר הנדחת when all the criteria for that judgment have been met?
The supreme Sanhedrin sends [emissaries] who investigate and probe until they have established clear proof that the entire city - or the majority of its inhabitants - have turned to the worship of false gods.
Afterwards, they send two Torah sages to warn them and to motivate them to repentance. If they repent, it is good. If they continue their wicked ways, the court commands the entire Jewish people to take up arms against them. They lay siege to the city and wage war against it until the city falls.
When the city falls, very many courts are set up, and [the inhabitants] are judged. All those people against whom two witnesses testify that they worshiped a false deity after receiving a warning are separated. If those who worshiped [the false deity] constitute only a minority [of the city's inhabitants], they are stoned to death, but the rest of the city is saved. If they constitute a majority, they are brought to the supreme Sanhedrin and their judgment is concluded there. All those who worshiped [the false deity] are executed by decapitation.
If the entire city was led astray, all of the inhabitants including the women and the children are slain by the sword. If a majority of the inhabitants were led astray, the transgressors' wives and children are slain by the sword. Whether the entire city or only a majority of its inhabitants were led astray, those who proselytized [on behalf of the false deity] are stoned to death.
All the property within it is collected within its main street. If it does not have a main street, a main street is made for it. If its main street is located outside its confines, its wall is extended until its [main street] is included within its confines, as [implied by Deuteronomy 13:17]: "[Gather all its goods] in the midst of its main street."
All live animals that are contained within are slain. All its property and the city [as a whole] are burned with fire. Burning them fulfills a positive commandment, as [the verse continues]: "Burn the city and all its goods entirely."
The property of the righteous men - i.e., the remainder of the city's inhabitants who were not led astray with the majority - that is located within the city should be burned together with all its property. Since they resided there, their fortunes are destroyed.
Whoever derives even the slightest benefit from [the city's property] receives a single measure of lashes, as [Deuteronomy 13:18] states: "Let nothing that has been condemned remain in your possession."
[The following rules apply when] the witnesses who testified against an עיר הנדחת were disqualified as zomemim: Whoever takes possession of any property is considered to have acquired it and may derive benefit from it, since the [incriminating testimony - and thus, the judgment based upon it -] has been nullified.
Why do they acquire it? Because each of the city's inhabitants gave up ownership of his property after the judgment was rendered.
[An עיר הנדחת] may never be rebuilt, and a person who rebuilds it is [liable for] lashes, as [Deuteronomy 13:17] states: "...never to be rebuilt." It is permitted to use it for gardens and orchards. "Never to be rebuilt" implies only that it should not be rebuilt as a city, as it was previously.
[The following laws apply to] a caravan which journeys from one place to another, passes through an עיר הנדחת, and is led astray with it: If they had remained [in the city] thirty days, they are executed by decapitation and their property is condemned. If they were there for a lesser period, they are executed by stoning, but their property is given to their heirs.
Property belonging to people of other cities which is kept within [an עיר הנדחת] is not burned, but rather is returned to its owners. [This applies] even when [the inhabitants of the עיר הנדחת] accepted responsibility for it, as implied by [Deuteronomy 13:17]: "its goods" - i.e., its goods, and not those belonging to others.
[The following rules apply to] property belonging to the wicked - i.e., those who were swayed [to idol worship] - which was kept in other cities. If [that property] was gathered together with the property of the עיר הנדחת, they are burned together. If not, it is not destroyed, but rather is given to the heirs.
If an animal which partially belongs to [an inhabitant of] an עיר הנדחת and partially belongs to [a person living in] another city is found within [the עיר הנדחת], it must be destroyed. [In contrast,] a loaf of bread which is owned by such [partners] is permitted, because it can be divided.
It is forbidden to benefit from an animal which belongs to [an inhabitant of] an עיר הנדחת and which was slaughtered, just as it is forbidden to derive benefit from an ox which was condemned to be stoned and was slaughtered.
We are permitted to benefit from the hair of both men and women of [the condemned city]. A wig, however, is considered part of "its goods," and is therefore forbidden.
Produce which is connected [to its source of nurture] is permitted, as [implied by Deuteronomy 13:17]: "Gather [all its goods...] Burn..." - i.e., this includes only those articles which must merely be gathered and burned, and thus excludes produce which is still connected [to its source of nurture], and would have to be severed and gathered in order to be burned.
The same principle applies to [the inhabitants'] hair. Needless to say, the trees themselves are permitted and are bequeathed to the heirs.
[The following rules apply to] the consecrated property within it: Those animals which were consecrated to be sacrificed on the altar themselves must die, since "the sacrifices of the wicked are an abomination" [Proverbs 21:27]. Property which is consecrated for the purposes of the Temple must be redeemed, and afterwards is burned, [as implied by the word] "its goods" - its goods and not those which are consecrated.
[The following rules apply to] firstborn animals and the animal tithes that are found within [the עיר הנדחת]: Those that are unblemished are considered to be animals consecrated to be sacrificed on the altar and must die. Those that are blemished are considered to be "its animals," and are slain [with them].
[The following rules apply to] terumah which is contained within the city: If it has already been given to a priest, it should be allowed to rot, because it is considered his private property. If it is still in the possession of an Israelite, it should be given to a priest in another city, because it is considered to be "the property of heaven," and its consecrated nature extends to its actual substance.
The second tithe, money used to redeem the second tithe, and sacred writings in it must be entombed.
Anyone who administers the judgment of an עיר הנדחת is considered as if he offered a burnt offering consumed entirely by fire, as [Deuteronomy 13:17] states: "...entirely for the sake of God, your Lord." Furthermore, such action diverts [Divine] wrath from the Jews, as [the following verse continues]: "so that God's fierce anger will be allayed," and it brings them blessing and mercy [as the verse] states: "And He will grant you mercy. He will deal mercifully with you and will make you flourish."