Edited sentence: Azerbaijan continued to decline after the reign of Shah Abbas as the Safavids divided the territory of Azerbaijan into four Beglerbegligs (beg[bey, bek, bay] is a noble Turkic title), or administrative areas: Tabriz, Chukhursada (Nakhchivan), Shirvan and Qarabagh.By 1722 an Afghan army marched across eastern Iran, besieged, and sacked Isfahan and proclaimed a Ghilzai tribesman Mahmud (of the Hotaki Pashtuns) the 'Shah' of Iran.Except for Shah Abbas II, the Safavid rulers after Abbas I were often incapable rulers.The end of Abbas II's reign in 1666 marked the beginning of the end of the Safavid dynasty.These were previously ruled by Qizilbash wakils, who were being replaced by a Persian aristocracy.This marked the end of the Safavid dynasty in both Iran and Azerbaijan