These became a formidable military force against the Mughals and later against the Afghan Empire