The history of slavery spans many different cultures, nationalities, and religions from ancient times to the present day. Likewise, its victims have come from many different ethnicities and religious groups. The social, economic, and legal positions of slaves have differed vastly in different systems of slavery in different times and places.Slavery has been found in some hunter-gatherer populations, particularly as hereditary slavery, but the conditions of agriculture with increasing social and economic complexity offer greater opportunity for mass chattel slavery. Slavery was institutionalized by the time the first civilizations emerged (such as Sumer in Mesopotamia, which dates back as far as 4000 BC). Slavery features in the Mesopotamian Code of Hammurabi (c. 1750 BC), which refers to it as an established institution.Slavery was widespread in the ancient world in Europe, Asia, the Middle East, Africa, and the Americas.
Slavery became less common throughout Europe during the Early Middle Ages but continued to be practiced in some areas. Both Christians and Muslims captured and enslaved each other during centuries of warfare in the Mediterranean and Europe. Islamic slavery encompassed mainly Western and Central Asia, Northern and Eastern Africa, India, and Europe from the 7th to the 20th century. Islamic law approved of enslavement of non-Muslims, and slaves were trafficked from non-Muslim lands: from the North via the Balkan slave trade and the Crimean slave trade; from the East via the Bukhara slave trade; from the West via Andalusian slave trade; and from the South via the Trans-Saharan slave trade, the Red Sea slave trade and the Indian Ocean slave trade.