Most of us consider Athene the protectress of Athens. However, she was also the patroness of Troy! She deserted the city during the Trojan War, however - her association with the city was not considered worth leaving an "insult" unavenged. She was important in many cities, as these myths show.
Athene claimed this city. However, Poseidon wanted the city and the land around it (Attica). Some, however, believe that Poseidon was the first to claim the city. He signified his claim to the city by creating a saltwater spring on the Akropolis, or a sea (the Erechthid sea, according to one source), or a horse.
Athene bided her time, waiting. When Kekrops came to the throne, she came to the Akropolis, and planted an olive tree. The enraged Poseidon challenged Athene to single combat. Zeus felt that the time had come to intervene, and said that the gods should decide. The deities were divided by gender, and Zeus did not give an opinion. Kekrops testified that Athene was the better deity to have for protectress. Athene won Athens, and Poseidon flooded the plain.
According to another source, the two deities had a contest. The one who gave the city the more valuable gift would win it. Poseidon gave the city either a saltwater spring or a horse. Salt water was not very useful, and the land was not very good for horses. Athene gave the city an olive tree. This provided food, fuel and oil, and so Athene won Athens. In the case of Troizen, Zeus commanded that Poseidon and Athene share the city. This didn't go down well with either deity!
Troy (literally, Troia) was also supposed to be protected by Athene. The city, in myth, even possessed the sacred Palladion, the image of Athene's friend Pallas (please click here for details). Legend held that the city could not be taken as long as the Palladion remained in the city.
When the Judgement of Paris went against Athene, her long-standing protection of the city went out of the window. She now hated all Trojans, and was one of the Greeks' three strongest supporters. (The others were Hera and Poseidon.) However, the Palladion remained in the city, and it was therefore safe. Athene helped Diomedes and Odysseus steal the Palladion, and (according to some) thought of the wooden horse - although most credit Odysseus with the idea. However, at least she avenged the Trojans - in a way.