Late in the 18th century the gold supply which provided the economic base for Minangkabau royalty began to be exhausted. Around the same time other parts of the Minangkabau economy had a period of unparalleled expansion as new opportunities for the export of agricultural commodities arose, particularly with coffee which was in very high demand. A civil war started in 1803 with the "Padri" fundamentalist Islamic group in conflict with the traditional syncretic groups, elite families and Pagaruyung royals. As a result of a treaty with a number of penghulu and representatives of the Minangkabau royal family, Dutch forces made their first attack on a Padri village in April 1821. The first phase of the war ended in 1825 when the Dutch signed an agreement with the Padri leader Tuanku Imam Bonjol to halt hostilities, allowing them to redeploy their forces to fight the Java War. When fighting resumed in 1832, the reinforced Dutch troops were able to more effectively attack the Padri. The main centre of resistance was captured in 1837, Tuanku Imam Bonjol was captured and exiled soon after, and by the end of the next year the war was effectively over.