Independent city states were unable to compete with Hellenistic kingdoms and were usually forced to ally themselves to one of them for defense, giving honors to Hellenistic rulers in return for protection. One example is Athens, which had been decisively defeated by Antipater in the Lamian war (323-322) and had its port in the Piraeus garrisoned by Macedonian troops who supported a conservative oligarchy. After Demetrius Poliorcetes captured Athens in 307 and restored the democracy, the Athenians honored him and his father Antigonus by placing gold statues of them on the agora and granting them the title of king. Athens later allied itself to Ptolemaic Egypt to throw off Macedonian rule, eventually setting up a religious cult for the Ptolemaic kings and naming one of the city phyles in honor of Ptolemy for his aid against Macedon. In spite of the Ptolemaic monies and fleets backing their endeavors, Athens and Sparta were defeated by Antigonus II during the Chremonidean War (267-61). Athens was then occupied by Macedonian troops, and run by Macedonian officials.