Numidia (Berber: Inumiden; 202–40 BC) was the ancient kingdom of the Numidians located in northwest Africa, initially comprising the territory that now makes up modern-day Algeria, but later expanding across what is today known as Tunisia, Libya, and some parts of Morocco. The polity was originally divided between the Massylii in the east and the Masaesyli in the west. During the Second Punic War (218–201 BC), Masinissa, king of the Massylii, defeated Syphax of the Masaesyli to unify Numidia into one kingdom. The kingdom began as a sovereign state and later alternated between being a Roman province and a Roman client state. Numidia, at its largest extent, was bordered by Mauretania to the west, at the Moulouya River, Africa Proconsularis to the east, the Mediterranean Sea to the north, and the Sahara to the south. It was one of the first major states in the history of Algeria and the Berbers. History Independence The Greek historians referred to these peoples as "Νομάδες" (i.e. Nomads), which by Latin interpretation became "Numidae" (but cf. also the correct use of Nomades). Historian Gabriel Camps, however, disputes this claim, favoring instead an African origin for the term. The name appears first in Polybius (second century BC) to indicate the peoples and territory west of Carthage including the entire north of Algeria as far as the river Mulucha (Muluya), about west of Oran. The Numidians were composed of two great tribal groups: the Massylii in eastern Numidia, and the Masaesyli in the west. During the first part of the Second Punic War, the eastern Massylii, under their king Gala, were allied with Carthage, while the western Masaesyli, under king Syphax, were allied with Rome. The Kingdom of Masaesyli under Syphax extended from the Moulouya river to Oued Rhumel. However, in 206 BC, the new king of the eastern Massylii, Masinissa, allied himself with Rome, and Syphax of the Masaesyli switched his allegiance to the Carthaginian side. At the end of the war, the victorious Romans gave all of Numidia to Masinissa of the Massylii. At the time of his death in 148 BC, Masinissa's territory extended from the Moulouya to the boundary of the Carthaginian territory, and also southeast as far as Cyrenaica to the gulf of Sirte, so that Numidia entirely surrounded Carthage (Appian, Punica, 106) except towards the sea. Furthermore, after the capture of Syphax the king in modern day Morocco with his