In the late 6th century BC, the Thebans were brought for the first time into hostile contact with the Athenians, who helped the small village of Plataea to maintain its independence against them, and in 506 BC repelled an inroad into Attica. The aversion to Athens best serves to explain the apparently unpatriotic attitude which Thebes displayed during the Persian invasion of Greece (480–479 BC). Though a contingent of 400 was sent to Thermopylae and remained there with Leonidas before being defeated alongside the Spartans, the governing aristocracy soon after joined King Xerxes I of Persia with great readiness and fought zealously on his behalf at the Battle of Plataea in 479 BC. The victorious Greeks subsequently punished Thebes by depriving it of the presidency of the Boeotian League and an attempt by the Spartans to expel it from the Delphic amphictyony was only frustrated by the intercession of Athens.