The seventeenth century was a period of slow decline for the Sultanate, as the monarch lost control of the economy, due to an influx of foreign currency, and the law, as Islamic legal scholars asserted their authority. Between 1769 and 1788 the Sultans were merely puppets of the Hamaj who following a successful revolt held the reigns of power as regents. As the sultans struggled to re-establish their rule and the regents fought to maintain their hold over the running of the country, the country became weakened and a target for the imperial ambitions of foreign powers.
In 1821, the army of general Ismail bin Muhammed Ali, son of the khedive of Ottoman Egypt, invaded Sennar. The forces of the Sultan, Badi VII, offered no resistance and on 14th June surrendered to Ismail, offering gifts and then having to watch the Ottoman troops loot his capital. Badi was restored as nominal rule of his lands, which were henceforth part of the Ottoman Empire.