Canon law classifies excommunication among the medicinal penalties, and the classification is the key to the institution. The precedents are two. In Matthew 18 the unrepentant offender, after private and then witnessed admonition, is to be treated as the gentile and the tax collector, put outside. In 1 Corinthians 5 Paul orders the Corinthian assembly to expel a man living in scandal, with a purpose clause that governed all later doctrine: that his spirit may be saved in the day of the Lord. Exclusion, on this warrant, is therapy at the limit: when every gentler correction has failed, the community withdraws its fellowship so that the offender may feel the weight of what has been broken and come back. The tradition institutionalized the logic.
Excommunication bars from the sacraments and from office, but the excommunicated remain baptized Christians, bound by their obligations, prayed for by name; the sentence is not a declaration about their soul's destiny, which the Church disclaims knowing, but about their standing at the table. And it is designed to end: absolution restores the penitent, and canonists insisted the censure must be lifted the moment its purpose is achieved. History supplies abundant abuse, excommunications wielded for politics, revenue and spite, interdicts flung over whole kingdoms, and the institution's defenders have always had to argue from its design against its record. But the design is coherent: a community that cannot exclude cannot mean anything by inclusion, and exclusion aimed at return is discipline, not vengeance.