The Indian campaign of Alexander the Great ended before Chandragupta came into power. Alexander had left India in 325 BCE and assigned the northwestern Indian subcontinent territories to Greek governors. The nature of early relationship between these governors and Chandragupta is unknown. Justin mentions Chandragupta as a rival of the Alexander's successors in north-western India. He states that after Alexander's death, Chandragupta freed Indian territories from the Greeks and executed some of the governors. According to Boesche, this war with the northwestern territories was in part fought by mercenaries hired by Chandragupta and Chanakya, and these wars may have been the cause of the demise of two of Alexander's governors, Nicanor and Philip. Megasthenes served as a Greek ambassador in his court for four years.