In the mid-fifteenth century, the religion of Sikhism was born. During the Mughal empire, many Hindus increasingly adopted Sikhism. These became a formidable military force against the Mughals and later against the Afghan Empire. After fighting Ahmad Shah Durrani in the later eighteenth century, the Sikhs took control of Punjab and managed to establish the Sikh Empire under Maharaja Ranjit Singh, which lasted from 1799 to 1849. The capital of Ranjit Singh's empire was Lahore, and the empire also extended into Afghanistan and Kashmir. Bhangi Misl was the fist Sikh band to conquer Lahore and other towns of Punjab. Syed Ahmad Barelvi a Muslim, waged jihad and attempted to create an Islamic state with strict enforcement of Islamic law. Syed Ahmad Barelvi in 1821 with many supporters and spent two years organising popular and material support for his Punjab campaign. He carefully developed a network of people through the length and breadth of India to collect funds and encourage volunteers, travelling widely throughout India attracting a following among pious Muslims. In December 1826 Sayyid Ahmad and his followers clashed with Sikh troops at Akora Khattak, but with no decisive result. In a major battle near the town of Balakot in 1831, Sayyid Ahmad and Shah Ismail Shaheed with volunteer Muslims were defeated by the professional Sikh Army.