Following the catastrophic sin of the Golden Calf, the Israelites stand at the brink of complete annihilation. To save the nation from utter destruction, an existential crisis demands a harsh and uncompromising response. An immediate punitive strike is required to purge the idolaters and forge a terrifying memory that will deter any future descent into idol worship [שד״ל].
The declaration that God has ordered this action raises a question among commentators, as no explicit instruction was recorded prior to this moment. The primary approach among commentators is that this directive relies on the earlier established law that anyone who sacrifices to foreign deities must be put to death [רש״י, ריב״א, חזקוני, פענח רזא]. Alternatively, this may have been an oral instruction given directly to Moses after God relented from destroying the entire nation, specifying that only the actual sinners should die to spare the rest of the people [רמב״ן, הטור הארוך]. It is also possible that Moses prophetically sensed God's will and spoke with the authority of a prophet [קאסוטו, רבנו בחיי, העמק דבר]. Invoking God specifically in His unique relationship with Israel emphasizes the sheer magnitude of the betrayal committed by the chosen nation, bound to Him by a special covenant [מלבי״ם, ביאור יש״ר]. This also functions as a measure for measure response. The sinners had pointed to the calf and proclaimed it to be the god of Israel, believing they were worshiping Him. Therefore, divine justice strikes them precisely under this association, publicly sanctifying God's name in the exact manner it was profaned [רמב״ן, רבנו בחיי, אבן עזרא הקצר].
The call for the Levites to arm themselves with swords signifies the organization of a resolute and forceful punitive strike [ביאור שטיינזלץ]. Because the sheer number of offenders makes a standard judicial process impossible, the Levites are granted an exceptional, temporary mandate to execute the idolaters by the sword in any way possible, functioning similarly to the laws governing a subverted, idolatrous city [רמב״ן, הטור הארוך]. In this capacity, the Levites act directly as judges and enforcers on God's behalf [ביאור יש״ר, מלבי״ם]. They are instructed to march publicly from one end of the camp to the other [קאסוטו]. This highly visible procession serves to atone for those who did not actively worship the calf but stood by silently without protesting. Just as they remained quiet during the sin, they are now forced to remain silent and watch as the Levites execute the offenders right before their eyes [ספורנו, הכתב והקבלה]. Additionally, the presence of armed Levites patrolling the camp serves to ward off evil spirits and negative spiritual forces from taking control during such a vulnerable and difficult hour [רקנאטי, שפתי כהן].
The demand to execute brothers, friends, and relatives is directed strictly at those who are definitively identified as having participated in the idol worship [רשב״ם, קאסוטו, אבן עזרא הקצר]. It requires the Levites to completely transcend human nature, refusing to show mercy or protect the guilty, even if they are their closest loved ones [רמב״ן, ביאור יש״ר]. Since the tribe of Levi did not participate in the sin, the command to kill a brother likely refers to a maternal half brother belonging to a different tribe that did sin [רש״י, מזרחי, שפתי חכמים], or to an actual biological brother in the rare event that one had strayed [אבן עזרא]. The precise detailing of these relationships encompasses all circles of human emotion. A brother represents a natural biological bond, while a friend represents a profound emotional connection independent of family; the Levites must overcome both [אור החיים]. This extreme self sacrifice, where the Levites nullify their personal desires solely out of love for God, grants them the terrifying aura of heavenly angels. This divine dread prevents the masses from rising up in rebellion against them [העמק דבר]. Furthermore, the inclusion of relatives extends the judgment to women and minors who actively sinned [נתינה לגר]. On a deeper level, it hints at an internal spiritual demand: a person must first judge what is close within themselves, correcting their own flaws, before attempting to execute justice upon others [שפתי כהן].