The present day Republic of Tunisia, al-Jumhuriyyah at-Tunisiyyah, is situated in Northern Africa. Geographically situated between Libya to the east, Algeria to the west and the Mediterranean Sea to the north. Tunis is the capital and the largest city (population over 800,000); it is near the ancient site of the city of Carthage.

Throughout its recorded history, the physical features and environment of the land of Tunisia have remained fairly constant, although during ancient times more abundant forests grew in the north, and earlier in prehistory the Sahara to the south was not an arid desert.

The weather is temperate in the north, which enjoys a Mediterranean climate with mild rainy winters and hot dry summers, the terrain being wooded and fertile. The Medjerda river valley (Wadi Majardah, northeast of Tunis) is currently valuable farmland. Along the eastern coast the central plains enjoy a moderate climate with less rainfall but significant precipitation in the form of heavy dews; these coastlands are currently used for orchards and grazing. Near the mountainous Algerian border rises Jebel ech Chambi, the highest point in the country at 1544 meters. In the near south, a belt of salt lakes running east–west cuts across the country. Further south lies the Sahara desert, including the sand dunes of the Grand Erg Oriental.

Early history

First peoples

Stone age tools dating from the Middle Stone Age (around 200,000 years ago) found near Kelibia are the earliest evidence of human activity in the region. Finds have been made of stone blades, tools, and small figurines of the Capsian culture (named after Gafsa in Tunisia), which lasted from around 10,000 to 6,000 BC (the Mesolithic period). Seasonal migration routes evidence their ancient journeys. Saharan rock art, consisting of inscriptions and paintings that show design patterns as well as figures of animals and of humans, are attributed to the Berbers and also to Native Africans from the south. Dating these outdoor art works has proven difficult and unsatisfactory. Egyptian influence is thought very unlikely. Among the animals depicted, alone or in staged scenes, are large-horned buffalo (the extinct bubalus antiquus), elephants, donkeys, colts, rams, herds of cattle, a lion and lioness with three cubs, leopards or cheetahs, hogs, jackals, rhinoceroses, giraffes, hippopotamus, a hunting dog, and various antelope. Human hunters may wear animal masks and carry their weapons. Herders are shown with elaborate head ornamentation; a few other human figures are shown dancing, while others are driving chariots or riding camels.

By five thousand years ago, a Neolithic culture was evolving among the sedentary proto-Berbers of the Maghrib in northwest Africa, characterized by the practice of agriculture and animal domestication, as well as the making of pottery and finely chipped stone arrowheads. They planted wheat, barley, beans and chick peas in their fields, and used ceramic bowls and basins, goblets, plates, and large cooking dishes daily. These were stored by hanging on the walls of their domiciles. Archaeological evidence shows these proto-Berbers were already "farmers with a strong pastoral element in their economy and fairly elaborate cemeteries," well over a thousand years before the Phoenicians arrived to found Carthage. Individual wealth was measured among the nomadic herders of the south by the number of sheep, goats, and cattle a man possessed. Finds of scraps of cloth woven in stripes of different colors indicate that these groups wove fabrics.

The religion of the ancient Berbers is undocumented and only funerary rites can be reconstructed from archaeological evidence. Burial sites provide an early indication of religious beliefs; almost sixty thousand tombs are located in the Fezzan alone, according to the Italian scholar Giacomo Caputo. A more recent tomb, the Medracen in eastern Algeria, still stands. Built for a Berber king and traditionally assigned to Masinissa (r. 202–149 BC), it may have belonged instead to his father Gala (or Gaia). The architecture of the elegant tower tomb of his contemporary Syphax shows Greek or Punic influence. Most other information about Berber religious beliefs comes from later, classical times. The Libyans believed that divine power showed itself in the natural world, and could, for example, inhabit bodies of water or reside in stones, which were objects of worship. Procreative power was symbolized by the bull, the lion, and the ram. Among the proto-Berbers in the area that is now Tunisia, images of fish, often found in mosaics excavated there, were phallic symbols that fended off the evil eye, while sea shells signified the female sex. Herodotus mentions that Libyans of the Nasamone tribe slept on the graves of their ancestors in order to induce dreams for divination. Libyans sacrificed to the sun and to the moon (Ayyur). Eventually supernatural entities became personalized as gods, perhaps influenced by Egyptian or Punic practice; yet the Berbers seemed to be "drawn more to the sacred than to the gods." Often only a little more than the names of the Berber deities are known, e.g., Bonchar, a leading god. Eventually, Berbero-Libyans came to adopt elements from ancient Egyptian religion. Herodotus writes of the divine oracle sourced in the Egyptian god Ammon located among the Libyans, at the oasis of Siwa. Later, Berber beliefs influenced the Punic religion of Carthage, the city-state founded by the Phoenicians.

Egyptian hieroglyphs from the early dynasties also testify to Libyans, the Berbers of the "western desert". First mentioned as the Tehenou during the pre-dynastic reigns of Scorpion II (c. 3050) and of Narmer (on an ivory cylinder), their appearance is later disclosed in a bas relief of the Fifth Dynasty temple of Sahure. Ramses II (r. 1279–1213) placed Libyan contingents in his army. Tombs of the 13th century BC show paintings of Libu leaders wearing fine robes, with ostrich feathers in their "dreadlocks", short pointed beards, and tattoos on their shoulders and arms. Evidently, Osorkon the Elder (Akheperre setepenamun), a Berber of the Meshwesh tribe, became the first Libyan pharaoh. Several decades later, his nephew Shoshenq I (r. 945–924) became Pharaoh of Egypt, and the founder of its Twenty-second Dynasty (945–715). In 926 Shoshenq I (thought to be Shishak of the Bible) successfully campaigned to Jerusalem then ruled by Solomon's heir.2 Chronicles 12:2–9.Hornung, Erik (1999) History of Ancient Egypt: An Introduction Ithaca: Cornell University Press. page 129. . For several centuries Egypt was governed by a decentralized system based on the Libyan tribal organization of the Meshwesh. Becoming acculturated, Libyans also served as high priests at Egyptian religious centers. Hence during the classical era of the Mediterranean, all of the Berber peoples of Northwest Africa were often known collectively as Libyans.Cf., Herodotus (c.484–c.425), The Histories IV, 167–201 (Penguin 1954, 1972) pp. 328–337; the Garamantes of the Libyan desert (the Fezzan) pp. 329, 332.

Farther west, foreigners knew some Berbers as Gaetulians (who lived in remote areas), and those Berbers more familiar as the Numidians, and as the Mauri or Maurisi (later the Moors). These Berber peoples interacted with Phoenicia and Carthage (who also used the name "Libyphoenicians"), and later with Rome. Yet prior to this era of history, sedentary rural Berbers apparently lived in semi-independent farming villages, composed of small tribal units under a local leader.Soren, Ben Khader, Slim, Carthage (Simon and Schuster 1990) pp. 44–45. Yet seasonally they might leave to find pasture for their herds and flocks. Modern conjecture is that robust feuding between neighborhood clans kept Berber political organization from rising above the village level, yet the military threat from the city-state of Carthage would inspire Berber villages to join in order to marshall large-scale armed forces under a strong leader. Social techniques from the nearby polity of Carthage were adopted and modified for Berber use. A bilingual (Punic and Berber) urban inscription of the 2nd century BC from Berber Numidia, specifically from the city of Thugga (modern Dougga, Tunisia), indicates a complex city administration, with the Berber title GLD (corresponding to modern Berber Aguellid, or paramount tribal chief) being the ruling municipal office of the city government; this office apparently rotated among the members of leading Berber families. Circa 220 BC, in the early light given us by historical accounts, three large kingdoms had arisen among the Berbers of Northwest Africa (west to east): (1) the Mauri (in modern Morocco) under king Baga; (2) the Masaesyli (in northern Algeria) under Syphax who ruled from two capitals, Siga (near modern Oran) and to the east Cirta (modern Constantine); and (3) the Massyli (south of Cirta, west and south of Carthage) ruled by Gala, father of Masinissa. Later Masinissa would receive full honors befitting an important leader from both Roman and Hellenic states. Berber ethnic identities were maintained during the long periods of dominance by Carthage and Rome.

During the first centuries of the Islamic era, it was said that the Berber tribes were divided into two blocs, the Butr (Zanata and allies) and the Baranis (Sanhaja, Masmuda, and others). The etymology of these names is unclear, perhaps deriving from tribal customs for clothing ("abtar" and "burnous"), or perhaps distinguishing the nomad (Butr) from the farmer (Baranis). The Arabs drew most of their early recruits from the Butr. Later, legends arose of an obscure, ancient invasion of Northwest Africa by the Himyarite Arabs of Yemen, from which a prehistoric ancestry was evidently fabricated: Berber descent from two brothers, Burnus and Abtar, who were sons of Barr, the grandson of Canaan (Canaan being the grandson of Noah through his son Ham).Genesis, in 10:1 & 6. The Hebrew Bible apparently does not list Barr as a descendant of Ham. Chapter 10 of Genesis is known as The Table of Nations. Both Ibn Khaldun (1332–1406) and Ibn Hazm (994–1064) as well as Berber genealogists held that the Himyarite Arab ancestry was totally unacceptable.H.T.Norris, Saharan Myth and Saga (Oxford Univ. 1972) pp. 26, 30, citing René Basset (1900 & 1901). Yet Norris also notes that E.F.Gautier (1942) found an echo in the 6th century Byzantine historian Procopius of the Himyarite myth, and conjectured an ancient Canaanite Völkerwanderungen, finding common cultural symbols. Ibid. p. 30. This legendary ancestry, however, played a role in the long Arabization process that. continued for centuries among the Berber peoples.

In their medieval Islamic history the Berbers may be divided into three major tribal groups: the Zanata, the Sanhaja, and the Masmuda. The Zanata early on allied more closely with the Arabs and consequently became more Arabized, although Znatiya Berber is still spoken in small islands across Algeria and in northern Morocco (the Rif and north Middle Atlas). The Sanhaja are also widely dispersed throughout the Maghrib, among which are: the sedentary Kabyle on the coast west of modern Algiers, the nomadic Zanaga of southern Morocco (the south Anti-Atlas) and the western Sahara to Senegal, and the Tuareg (al-Tawarik), the well-known camel breeding nomads of the central Sahara. The descendants of the Masmuda are sedentary Berbers of Morocco, in the High Atlas, and from Rabat inland to Azru and Khanifra, the most populous of the modern Berber regions.For Masmuda descendant population, cf., Grimes (ed.), Ethnologue (12th ed. 1992) p. 307.