After the downfall of Athens at the end of the Peloponnesian War, the Thebans, having learned that Sparta intended to protect the states that Thebes desired to annex, broke off the alliance. In 404 BC, they had urged the complete destruction of Athens; yet, in 403 BC, they secretly supported the restoration of its democracy in order to find in it a counterpoise against Sparta. A few years later, influenced perhaps in part by Persian gold, they formed the nucleus of the league against Sparta. At the Battle of Haliartus (395 BC) and the Battle of Coronea (394 BC), they again proved their rising military capacity by standing their ground against the Spartans. The result of the war was especially disastrous to Thebes, as the general settlement of 387 BC stipulated the complete autonomy of all Greek towns and so withdrew the other Boeotians from its political control. Its power was further curtailed in 382 BC, when a Spartan force occupied the citadel by a treacherous coup-de-main. Three years later, the Spartan garrison was expelled and a democratic constitution was set up in place of the traditional oligarchy. In the consequent wars with Sparta, the Theban army, trained and led by Epaminondas and Pelopidas, proved itself formidable (see also: Sacred Band of Thebes). Years of desultory fighting, in which Thebes established its control over all Boeotia, culminated in 371 BC in a remarkable victory over the Spartans at Leuctra. The winners were hailed throughout Greece as champions of the oppressed. They carried their arms into Peloponnesus and at the head of a large coalition, permanently crippled the power of Sparta, in part by freeing many helot slaves, the basis of the Spartan economy. Similar expeditions were sent to Thessaly and Macedon to regulate the affairs of those regions.