While the practice and claims of extraterritoriality originated in antiquity, most notably in Egypt, Greece, and Rome, it was during the Middle Ages that its modern principles were established. As early as the twelfth century, Italian cities such as Genoa, Venice, and Pisa secured protection for their merchants in Egypt, Constantinople, and the Barbary States of North Africa. In northern Europe, the Hanseatic League obtained jurisdictional rights for its merchants within its trading region. During the next three centuries, Turkey granted so-called capitulary rights to Great Britain, the Netherlands, Italy, Denmark, Germany, Russia, Spain, Portugal, and the United States.
The problem of guaranteeing such protection, especially in the Islamic and Asian countries, was responsible for the eventual development of a system of extraterritoriality. Although differences in cultures, religions, and legal systems between Western Christian countries and those of Africa, the Near East, and Asia motivated Western countries to secure legal and economic exemptions for their nationals, the roots of extraterritoriality can be traced to ancient times. During antiquity, legal rights and obligations in Egypt, Greece, and Rome were deemed an integral part of membership in the community and could never be extended to aliens—the "strangers within the gates." However, merchants and traders traveling to distant lands were often permitted to reside and to establish trade factories, to manage their own affairs, to build temples, and to live according to their own customs, ceremonies, and rites.
By the end of the eighteenth century, a significant change had occurred in the concept of extraterritoriality. Before the Treaties of Westphalia (1648), which ended the Thirty Years' War and established the basis for the modern European system of nation-states, the notion of territorial sovereignty had not taken definite and concrete form. Sovereignty was generally viewed as personal rather than territorial, and it was related to the theory of the personalization of laws: that a foreigner carried his own law wherever he went. It was the ruler's duty to protect those who swore personal allegiance to him. Such allegiance was usually rendered by military service, and, in the case of Asian nations, by the payment of tribute as well. Following the Treaties of Westphalia, however, the concept of territorial sovereignty collided with the notions of personal sovereignty and the personality of laws, especially when the national right of territorial jurisdiction became a basic tenet of Western international law.
The recognition of territorial sovereignty in the West had a profound impact on the Ottoman Empire and in the Orient, where the principle that law was personal rather than territorial persisted for a long period of time. It affected, in particular, the relationships between Christian Europe and the Islamic and Asian countries, which were viewed as outside the pale of "civilization." Since these states were considered beyond the sphere of international law, it was held that European subjects and citizens had to be protected from the barbarities of "uncivilized" peoples, at least until the latter conformed to the standards of law and justice that Europeans considered just and equitable. Europeans chafed at the idea of being subservient to the laws of "inferior" civilizations. Such subservience, they felt, did violence to their dignity, pride, and concepts of justice. On their part, Muslims and Chinese held foreigners in disdain because they believed in the superiority of their own virtues and civilization.
From the earliest times, foreign ambassadors, government officials, and diplomatic representatives were granted a special status and exemption from local jurisdiction. This privilege later became known as the right of "exterritoriality." Diplomatic immunities were acknowledged in Western countries and in most non-Western states as well. Extraterritoriality was distinguished from exterritoriality in that it applied not simply to foreign diplomats and government officials, but to foreign nationals residing abroad. The special rights and immunities involved were specifically defined in treaties, and were not reciprocal. Although initially the bestowal of extraterritorial rights did not connote any loss of territorial sovereignty, but instead symbolized the beneficence of the grantor state, such was not the case following the Treaties of Westphalia. The imposition of extraterritoriality clearly came to represent the superiority of Western Christian countries over inferior, backward, and "uncivilized" peoples. In this sense, modern extraterritoriality served not only as a protective shield but also as an instrument to further penetration and imperialistic expansion.