The cities of Ionia remained independent until they were conquered by the Lydians of western Asia Minor. The Lydian king Alyattes II attacked Miletus, a conflict that ended with a treaty of alliance between Miletus and Lydia, that meant that Miletus would have internal autonomy but follow Lydia in foreign affairs.  At this time, the Lydians were also in conflict with the Median Empire, and the Milesians sent an army to aid the Lydians in this conflict. Eventually a peaceable settlement was established between the Medes and the Lydians, with the Halys River set up as the border between the kingdoms.  The famous Lydian king Croesus succeeded his father Alyattes in around 560 BC and set about conquering the other Greek city states of Asia Minor.