Medieval communes in the European Middle Ages had sworn allegiances of mutual defense (both physical defense and of traditional freedoms) among the citizens of a town or city. They took many forms, and varied widely in organization and makeup.
During the 10th century in several parts of Western Europe, peasants whether due to their knowledge of a special craft beyond the immediate requirements of their isolated village, or merely a self-reliant spirit, began to gravitate towards walled population centers.
Such townspeople needed physical protection from lawless nobles and bandits, part of the motivation for gathering behind communal walls, but the struggle to establish their liberties, the freedom to conduct and regulate their own affairs and security from arbitrary taxation and harassment from the bishop, abbot, or count in whose jurisdiction these obscure and ignoble social outsiders lay, was a long process of struggling to obtain charters that guaranteed such basics as the right to hold a market. Such charters were often purchased at exorbitant rates, or granted, not by the local power, which was naturally jealous of prerogatives, but by the king or the emperor, who came thereby to hope to enlist the towns as allies in the struggle to centralize power that was arising in tandem with the rise of the communes.
The walled city represented protection from direct assault at the price of corporate interference on the pettiest levels, but once a townsman left the city walls, he (for women scarcely travelled) was at the mercy of often violent and lawless nobles in the countryside. Because much of medieval Europe lacked central authority to provide protection, each city had to provide its own protection for citizens both inside the city walls, and outside. Thus towns formed communes, a legal basis for turning the cities into self-governing corporations. Although in most cases the development of communes was connected with that of the cities, there were rural communes, notably in France and England, that were formed to protect the common interests of villagers.
Every town had its own commune and no two communes were alike, but at their heart, communes were sworn allegiances of mutual defense. When a commune was formed, all participating members gathered and swore an oath in a public ceremony, promising to defend each other in times of trouble, and to maintain the peace within the city proper.
What did it mean for a commune member to defend another? If a commune member was attacked outside the city, it was too late to call for help, as it was unlikely anyone would arrive in time. Instead, the commune would promise to exact revenge on the attacker, the threat of revenge being a form of defense. However, if the attacker was a noble, safely ensconced in a castle (as was often the case), the town commune could not muster the forces to attack him directly. Instead they might attack the noble’s family, burn his crops, kill his serfs, or destroy his orchards in retribution.