The Massylii or Maesulians were a Berber federation of tribes in eastern Numidia, which was formed by an amalgamation of smaller tribes during the 4th century BC. They were ruled by a king. On their loosely defined western frontier was the powerful rival, the kingdom of the Masaesyli. To their east lay the territory of the rich and powerful Carthaginian Republic. Their relationship to Carthage resembled that of a protectorate. Carthage maintained its dominance over the Massylii by skillful diplomatic manoeuvering, playing off local tribal and kingdom rivalries. The principal towns of the Massylii were Cirta, Tébessa and Thugga.
In 218 BC war broke out between the Carthaginians and the Romans. The Massylii and the Masaesyli who both possessed a strong and proficient cavalry force were allied to the Carthaginian cause and performed valuable service for them in Iberia and Italy. In 206 BC a Massylian prince called Masinissa defected to the Romans. When the Romans finally defeated the Carthaginians in 202 BC they amalgamated the territory of the Massylii and the Masaesyli into one kingdom and gave it to Massinissa who ruled it until his death in approximately 148 BC.