Xenophon served as a young man in the cavalry in the war between Athens and Sparta, after which he became a student of Socrates. Distrustful of democracy (a feeling later exacerbated after Socrates' death), he left Athens when democracy was reestablished in 410 BCE. For some years he served as a mercenary under the Persian prince Cyrus, leading a force of Greeks known as the Ten Thousand in wars in the Near East, which he described in his Anabasis. Later he served the Spartan king Agesilaus II, at witnessed the Battle of Coronea at which Sparta destroyed his native city of Athens. For his service to the enemy, Athens banished Xenophon from the city. The banishment was revoked when Athens and Sparta united against the common Theban enemy in 365 BCE, and Xenophon returned to Athens where he spent the rest of his life.
In addition to the Anabasis, Xenophon wrote three works in which he defended Socrates (the Apology, the Symposium, and the Memorabilia), and a treatise on the education of a prince called the Cyropaedia.