As a result of the confusion in Greece at the end of the Second Macedonian War, the Seleucid Empire also became entangled with the Romans. The Seleucid Antiochus III had allied with Philip V of Macedon in 203 BC, agreeing that they should jointly conquer the lands of the boy-king of Egypt, Ptolemy V. After defeating Ptolemy in the Fifth Syrian War, Antiochus concentrated on occupying the Ptolemaic possessions in Asia Minor. However, this brought Antiochus into conflict with Rhodes and Pergamum, two important Roman allies, and began a 'cold war' between Rome and Antiochus (not helped by the presence of Hannibal at the Seleucid court). Meanwhile, in mainland Greece, the Aetolian League, which had sided with Rome against Macedon, now grew to resent the Roman presence in Greece. This presented Antiochus III with a pretext to invade Greece and 'liberate' it from Roman influence, thus starting the Roman-Syrian War (192–188 BC). In 191 BC, the Romans under Manius Acilius Glabrio routed him at Thermopylae and obliged him to withdraw to Asia. During the course of this war Roman troops moved into Asia for the first time, where they defeated Antiochus again at the Battle of Magnesia (190 BC). A crippling treaty was imposed on Antiochus, with Seleucid possessions in Asia Minor removed and given to Rhodes and Pergamum, the size of the Seleucid navy reduced, and a massive war indemnity invoked.