Medieval townspeople in western Europe during the period of the High Middle Ages needed protection from lawless nobles and bandits. The walled city was protection from direct assault, but once a townsperson left the city walls, he or she was at the mercy of often violent and lawless nobles in the countryside. Because much of medieval Europe lacked central authority to provide protection, such as a police force (to use a modern analogy), each city had to provide its own protection for citizens both inside the city walls, and outside. In order to do this towns formed what are called communes. 

Every town had its own commune and no two communes were alike, but at the heart, communes were sworn alliegences of mutual defense. When a commune was formed, all particpitating members gathered and swore an oath together, in public, they would defend each other in time of trouble. In addition they would swear to maintain the peace within the city proper. 

What did it mean for a commune member to defend another? Obviously if a commune member was attacked outside the city it was too late to call for help as it would be unlikely anyone would be around in time. Instead the commune would promise to exact revenge on the attacker, the promise of revenge being a form of defense. However, what would happen if the attacker was a noble who had a castle, too strong for the townspeople? This was often the case and certainly the town commune could not muster the forces to attack a castle. Instead they might attack the nobles family, or burn his crops, or kill his serfs, or destroy his orchards. It was eye for eye violent revenge. 

The commune movement started in the 11th century in northern Italy which had the most urbanized population of Europe at the time, and in what is now Belgium which was also relatively urban at the time. It then spread in the early 12th century to France, Germany, and Spain and elsewhere. England never saw much of the commune movement because it was by comparison a pretty well run kingdom and did not need local protection forces. 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.

The Church and King both had mixed reactions to communes. On the one hand they agreed safety and protection from lawless nobles was in everyones best interest. The communes intention was to keep the peace through the threat of revenge, and the Church was sympathetic to the end result of peace. However the Church had their own ways to enforce the peace such as the Peace and Truce of God movement, for example. On the other hand, communes disrupted the order of medieval society. The methods the commune used, eye for an eye, violence begets violence, were generally not acceptable to Church or King. Normally only the noble lords are allowed to fight and the merchant townspeople were the workers, not fighters. There was a sense the communes were a threat to the medieval 3-tiered social order: Those who work, those who pray, those who fight. Communes crossed the line between working and fighting. As such communes were sometimes accepted, and other times not by the Church and King. One of the most famous cases of a commune being suppressed and the resulting defiant urban revolt occurred in the French town of Laon in 1112.

Middle Ages