The Saffarid dynasty (Persian: صفاریان, romanized: Safāriyān) was a culturally Persianate dynasty of eastern Iranian origin that ruled over parts of Persia, Greater Khorasan, and eastern Makran from 861 to 1002. One of the first indigenous Persian dynasties to emerge after the Islamic conquest, the Saffarid dynasty was part of the Iranian Intermezzo. The dynasty's founder was Ya'qub bin Laith as-Saffar, who was born in 840 in a small town called Karnin (Qarnin), which was located east of Zaranj and west of Bost, in what is now Afghanistan. A native of Sistan and a local ayyār, Ya'qub worked as a coppersmith (ṣaffār) before becoming a warlord. He seized control of the Sistan region and began conquering most of Iran and Afghanistan, as well as parts of Pakistan, Tajikistan and Uzbekistan.
The Saffarids used their capital Zaranj as a base for an aggressive expansion eastward and westward. They first invaded the areas south of the Hindu Kush, and then overthrew the Tahirid dynasty, annexing Khorasan in 873. By the time of Ya'qub's death, he had conquered the Kabul Valley, Tocharistan, Makran (Balochistan), Kerman, Fars, Khorasan, and nearly reached Baghdad but then suffered a defeat by the Abbasids.