On 13 February 1739 the Persians under the military genius Nader Shah, the commander of the Afsharids, had deposed the former Safavid dynasty, then defeated Persia's arch rival, the Ottoman Empire several times, and had therefore secured the western front. Now his eyes turned upon the wealthy but weakened Mughal Empire. In the year 1739, Nader Shah invaded the Mughal Empire, and defeated Muhammad Shah during the Battle of Karnal in less than three hours, and then marched upon the Mughal capital Delhi, and after a chain of events, he completely sacked and looted it, and occupied much of the northern regions of the Mughal Empire.