The 37-year rule of Feroz Shah Tughlaq ended in 1388, following a period of disunity and revolt in the last years of his reign. The first civil war began in 1384, weakening the empire as provinces and territories became independent. A second civil war erupted in 1394, six years after the death of Feroz Shah. Much of the discontent arose from the ways in which the Tughlaq dynasty organized the administration of the empire. The Muslim ruling elite were given a kind of contract to gather tax from the non-Muslim population, almost all Hindu. This was gathered and shared on a 20:80 basis with the local Na’ib (local ruler) getting 20 per cent and the Sultan getting 80 per cent of revenues. During a period of economic decline Feroz Shah reversed the split, with the local ruler retaining the bulk of the income. This was intended to pay for soldiers and collectors to enforce the tax laws, but also led to rampant corruption and arguments over contracts and subcontracts. In 1394, two contenders for the throne emerged out of the chaos. Nasir-ud-din Nusrat Shah Tughluq, or Nusrat Shah, who ruled over most of the Sultanate’s remaining lands, while his rival Nasir-ud-Din Mahmud Shah Tughluq, or Mahmud Shah, also claimed the Sultanate from the safety of his fort near Delhi. In 1398 the Turco-Mongol conqueror Tamerlane (Timur) attacked the Sultanate, sacking Talanba and Multan, fighting his way to Delhi where he met and defeated the army of Mahmud Shah, who fled eastwards but survived to be the last of the Tughlaq dynasty, outliving Nusrat Shah.