The Nanda dynasty ruled in the northern part of the Indian subcontinent during the 4th century BCE, and possibly during the 5th century BCE.