The islands then passed under Ptolemaic domination. During the Chremonidean War, mercenary garrisons had been set up on certain islands, among them Santorini, Andros and Kea. But, defeated at the Battle of Andros sometime between 258 and 245 BC, the Ptolemies ceded them to Macedon, then ruled by Antigonus II Gonatas. However, because of the revolt of Alexander, son of Craterus, the Macedonians were not able to exercise complete control over the archipelago, which entered a period of instability. Antigonus III Doson put the islands under control once again when he attacked Caria or when he destroyed the Spartan forces at Sellasia in 222 BC. Demetrius of Pharos then ravaged the archipelago and was driven away from it by the Rhodians.