Somali nationality law is regulated by the Constitution of Somalia, as amended; the Somali Citizenship Law, and its revisions; and various international agreements to which the country is a signatory. These laws determine who is, or is eligible to be, a national of Somalia. The legal means to acquire nationality, formal legal membership in a nation, differ from the domestic relationship of rights and obligations between a national and the nation, known as citizenship. Nationality describes the relationship of an individual to the nation under international law, whereas citizenship is the domestic relationship of an individual and the state. Somali nationality is typically obtained under the principle of jus soli, i.e. by birth in Somalia, or jus sanguinis, born to parents with Somali nationality. It can be granted to persons with an affiliation to the country, or to a permanent resident who has lived in the country for a given period of time through grant (naturalization).

Acquisition of nationality Nationality can be acquired in Somalia at birth if the father is Somali.

By birth Those who acquire nationality at birth include children born anywhere as long as their father is Somali, meaning a person who by language, origin, or custom is considered to be part of the Somali nation and they have no other nationality. Foundlings or minor orphans of unknown parentage, under Article 15 of the Somali Citizenship Law are presumed to have a Somali father unless proven otherwise and Somali of origin, meaning they automatically acquire nationality.

By grant Naturalization, known as citizenship by grant, can be acquired persons who have resided in the territory for a sufficient period of time to confirm they understand the customs and traditions of the society. General provisions are that applicants have good character and conduct and have resided in the country for a minimum of seven years. There are no provisions for adoptees to acquire nationality in the statutes and when Somalia acceded to the Convention on the Rights of the Child in 2015, they did not agree to Article 20 of the convention concerning child adoptions. Children are required to hold the same nationality as their father, unless he is stateless, in which case, they may acquire the nationality of their mother per Article 14 of the Somali Citizenship Law. However, a child who acquired nationality from its mother may renounce it upon reaching the age of majority. Besides foreigners meeting the criteria, other persons who may be naturalized include:

The wife of a Somali national automatically acquires her husband's nationality upon marriage;

Honorary nationality may be granted for exceptional service to the nation at the discretion of the President of Somalia.

Loss of nationality Somali nationals can renounce their nationality provided they obtain permission from the state. Nationals of origin may not be denaturalized in Somalia. Naturalized persons may lose their nationality by committing crimes against the state or state security or for fraud, misrepresentation, or concealment in a naturalization petition. Nationals who have previously lost their Somali nationality may repatriate by establishing residency for a minimum of three years and applying for naturalization.

Dual nationality Under the nationality law, dual nationality is forbidden in Somalia, but under the 2012 Provisional Constitution of the Federal Republic of Somalia, which overrides other laws, it is permitted.

History Historical reference to the Land of Punt occurs in Egyptian records from 3000 BCE. At that time, the peoples of the region included the Jiiddu of the Digil or Rahanweyn clan. By the end of the millennium, both Tunni and Garre tribes had moved into the Jubba Valley. In the first centuries of the common era, migrants from Yemen and Oman settled on the eastern coast of the region. The coastal people engaged in trade with merchants seeking frankincense and myrrh from Abyssinia, Egypt, Greece, Phoenicia, Persia, and Rome. By the sixth century, Zeila had become a major commercial center trading goods from the African interior with foreign merchants. Mogadishu arose as a center of commerce in the south brokering trade with Swahili merchants who brought goods from China, India, and Southwest Asia. In 755 the Persian Abbasid Caliphate subjugated the inhabitants of Mogadishu requiring them to pay taxes.

Africans and outsider contact (11th–17th centuries) Between the eleventh and thirteenth centuries, the region converted to Islam. Intermarriage created an Islamic Arab-Somali elite, who established strong, but independent city-states, that dominated both commerce and politics along the coast. In 1300 Abyssinia made the Sultanates of Bale, Dawaro, Fatajar, Hadiya, Harar and Ifat vassal states and required their sultans to pay tribute. Zeila and the other city states, attempted to extend their authority over nomadic peoples in the interior to create a defensive buffer between their strongholds and Abyssinian invaders. In northern Somaliland, sultans had little power, and their title was mostly honorific. Without hierarchical authority, nomadic groups were bound by patrilineal kinship ties, which determined alliances and socio-political divisions. Following the Islamic system of diya, clans had a contractual alliance to pay to and receive damages from other clans, for losses sustained to persons or property. As the payments are collectively paid to the group, collaboration, cooperation, consensus among the males in the clan was necessary to provide for the group security and resolve legal issues.

By the late thirteenth the Hawiye clan had expanded from the Shebelle Valley toward the coast, subjugating the area between Itala and Merca. The Ajuran Sultanate moved into the Shebelle River basin and established coastal commerce links. In the early fourteenth century, the Sultan of Ifat, seized the Abyssinian Sultanates of Bale and Harar, holding them until 1415. After the defeat of the Ifat dynasty, the Adal Sultanate rose to dominate its former territory from their capital at Zeila. Though the Sultan of Adal would remain in power until 1577, between 1445 and 1471 Adal was a vassal state of Abyssinia. In 1499, the Portuguese navigator Vasco da Gama attempted but failed to capture Mogadishu, as did Portuguese attempts to secure Barawa in 1506 and Zeila in 1517. However, in 1507 a Portuguese trading fort was established on Socotra Island. In 1517, Abyssinian and Portuguese troops aligned to capture Zeila and in response the Adal Sultanate recruited troops from the Ottoman Empire. The Ottomans remained in the territory, and in 1557 occupied Arkiko and Massawa.

Around 1560, the Silcis Sultanate of the Hawiye clan moved into the Lower Shabelle Valley and established tributary requirements from the Geledi and Wacdaan subclans. The Silcis may have been part of the Ajuran Sultanate, or its successor in the area of Afgooye. Fighting between the factions continued into the 1570s, when it was halted by the Oromo migration into the southwestern territory of Abyssinia. The struggle to control trade routes caused repeated conflict, which in turn led to migrations of inhabitants. In the seventeenth century the Rahanweyn clan migrated south displacing the Ajuran confederation in the Jubba and Shebelle river basins. The remnants of the Ajuran confederation, as well as their Madanle allies, and the Muzaffarids who had been ousted from Mogadishu in 1624, moved into the northeastern parts of Kenya. Around the same time, the Hiraab Imamate emerged in southern Somalia.

Pre-colonial period (18th century-1889) As had been the case in earlier centuries, no single entity ruled in Somalia and Europeans increasingly were encroaching on their territory. While there were no firm borders between the territories ruled by local rulers, they shared grazing territory and engaged in trade, which often became the grounds of conflict. In the early part of the eighteenth century the Geledi and Wacdaan, who lived on opposite sides of the Shabelle River, joined forces to oust the Silcis Sultanate. This action gave rise to the founding of the Geledi Sultanate around 1750, which along with their Wacdaan allies, became the dominant political entity in southern Somalia through the nineteenth century. The Majeerteen Sultanate arose in 1800, in the region now known as Puntland. Another prominent group that emerged in the northwestern portion of the territory was the Isaaq Sultanate. In 1839, the British established a trading fort in Aden, and signed treaties with the Isaaq clan rulers to access food supplies. In 1846, , a French naval officer, led an expedition to visit the southern coast of Somalia. By the 1850s, the Omani Sultanate, based in Zanzibar, had imposed control over the sultanates on the Banaadir coast and the northern coast was under the control of the Sharif of Mukha, a Yemeni vassal of the Ottoman Empire.

In 1850, Britain signed an agreement with the Majeerteen Sultanate to protect British ships in their waters in exchange for an annual subsidy. France signed treaties with the Sultan of Afar in 1862 and with the Issa elders in 1874, allowing the French to occupy Obock and Tadjoura. In the 1860s civil war ensued in the Majeerteen Sultanate, which lasted five years and resulted in the exile of their ruler. In 1865, Karl Klaus von der Decken, a German explorer, navigated the River Jubba, but was halted by the rapids above Bardera. In the 1870s, the exiled Majeerteen ruler returned and after conquering the Hawiye clans, founded the Sultanate of Hobyo. After the Berlin Conference of 1884–1885, the British began signing agreements with traditional leaders in territory that bordered Ethiopia, French Somaliland (now Djibouti), Italian Somaliland and the Kenya Colony. In exchange for protection from aggressors of the local leaders, the treaties secured protected trade rights for Britain. In 1887, the British notified the signatories to the Berlin agreement of their intent to establish Somaliland as a British protectorate.

Southern Somalia under Italian rule (1889–1960) Protectorate (1889–1941) Since the unification of Italy in 1870, there was an Italian drive to acquire colonial possessions. Having been unable to secure a protectorate in Tunisia, which was annexed by France in 1881, Italians focused on purchasing the Assab Bay in Eritrea in 1882. In 1889, they signed a treaty with the Sultan of Hobyo, extending a protectorate over his territory. Between 1889 and 1901, they made agreements to acquire the territory of the Sultan of Majeerteen and in 1893, secured treaties to control trade in the port cities of Barawa, Merca, Mogadishu and Uarscheich. They also attempted to extend their rule into Ethiopia in 1896, but were defeated. After the signing of an agreement in 1905 to establish a protectorate over the Nogal region, the Italians decided to unite all of their protectorates into a single administrative unit known as Italian Somaliland (Somala italiana) in 1908.

Italian subjecthood was first declared during the Unification of Italy in 1861. As the states united, their former kingdoms and duchies ceased to exist and no alternative means of belonging had been devised. Thus, in March 1861 the former Savoy-Piedmont-Sardinia Kingdom officially proclaimed that the former Piedmontese subjecthood was extended to the entirety of Italy. Inhabitants were afforded protection based upon their allegiance to the monarchy. Subjecthood was derived from an Italian father, and could only be derived maternally if the father was unknown. Birth in the territory was treated differently in different areas; in some states it conferred subjecthood, and in others it did not. Naturalization and denaturalization processes also varied depending upon the province. In 1865 laws from the various states was codified into national legislation, including a new civil code, which went into force on 1 January 1866.