Following the defeat of his erstwhile ally Philip by Rome in 197 BC, Antiochus saw the opportunity for expansion into Greece itself. Encouraged by the exiled Carthaginian general Hannibal, and making an alliance with the disgruntled Aetolian League, Antiochus launched an invasion across the Hellespont. With his huge army he aimed to establish the Seleucid empire as the foremost power in the Hellenic world, but these plans put the empire on a collision course with the new rising power of the Mediterranean, the Roman Republic. At the battles of Thermopylae (191 BC) and Magnesia (190 BC), Antiochus's forces suffered resounding defeats, and he was compelled to make peace and sign the Treaty of Apamea (188 BC), the main clause of which saw the Seleucids agree to pay a large indemnity, to retreat from Anatolia and to never again attempt to expand Seleucid territory west of the Taurus Mountains. The Kingdom of Pergamum and the Republic of Rhodes, Rome's allies in the war, gained the former Seleucid lands in Anatolia. Antiochus died in 187 BC on another expedition to the east, where he sought to extract money to pay the indemnity.