Habiru (sometimes written as Hapiru, and more accurately as ʿApiru, meaning "dusty, dirty"; Akkadian: 𒄩𒁉𒊒, ḫabiru) is a term used in 2nd-millennium BCE texts throughout the Fertile Crescent for people variously described as rebels, outlaws, raiders, mercenaries, bowmen, servants, slaves, and laborers.
In the time of Rim-Sin I (1822 BC to 1763 BC), the Sumerians knew a group of Aramaean nomads living in southern Mesopotamia as Habiru. The word Habiru, more properly ʿApiru, occurs in hundreds of 2nd millennium BCE documents covering a 600-year period from the 18th to the 12th centuries BCE and found at sites ranging from Egypt, Canaan and Syria, to Nuzi (near Kirkuk in northern Iraq) and Anatolia (Turkey), frequently used interchangeably with the Sumerian SA.GAZ, a phonetic equivalent to the Akkadian (Mesopotamian) word saggasu ("murderer, destroyer").
Not all Habiru were murderers and robbers: in the 18th century a north Syrian king named Irkabtum (c. 1740 BC) "made peace with [the warlord] Shemuba and his Habiru,"  while the ʿApiru, Idrimi of Alalakh, was the son of a deposed king, and formed a band of ʿApiru to make himself king of Alalakh. What Idrimi shared with the other ʿApiru was membership of an inferior social class of outlaws, mercenaries, and slaves leading a marginal and sometimes lawless existence on the fringes of settled society. ʿApiru had no common ethnic affiliations and no common language, their personal names being most frequently West Semitic, but many East Semitic, Hurrian or Indo-European.
In the Amarna letters from the 14th century BCE, the petty kings of Canaan describe them sometimes as outlaws, sometimes as mercenaries, sometimes as day-labourers and servants. Usually they are socially marginal, but Rib-Hadda of Byblos calls Abdi-Ashirta of Amurru (modern Lebanon) and his son ʿApiru, with the implication that they have rebelled against their common overlord, the Pharaoh. In "The Conquest of Joppa" (modern Jaffa), an Egyptian work of historical fiction from around 1440 BCE, they appear as brigands, and General Djehuty asks at one point that his horses be taken inside the city lest they be stolen by a passing ʿApir.[broken footnote]
The biblical word "Hebrew", like Habiru, began as a social category, and evolved into an ethnic one.  Since the discovery of the 2nd millennium BCE inscriptions mentioning the Habiru, there have been many theories linking these to the Hebrews of the Bible.
As pointed out by Moore and Kelle, while the ʿApiru/Habiru may be related to the biblical Hebrews, they also appear to be composed of many different peoples, including nomadic Shasu and Shutu, the biblical Midianites, Kenites, and Amalekites, as well as displaced peasants and pastoralists.
Scholars such as Anson Rainey have noted, however, that while ʿApiru covered the regions from Nuzi to Anatolia as well as Northern Syria, Canaan and Egypt, they were never confused with Shutu (Sutu) or Shasu (Shosu), Syrian pastoral nomads in the Amarna letters or other texts of the time.