In Sophocles' Ajax, the playwright considers what happens when a hero's friends become his enemies. Ajax, thwarted in his efforts to acquire the armor of Achilles, tries to kill his fellow Greeks, namely Agamemnon, Menelaus, and Odysseus. Fortunately for his comrades, goddess Athene causes Ajax to go insane and Ajax kills some cattle instead of the men.
Once Ajax realizes what he has done, he tries to regain his heroic status. Ajax had widely been regarded as the mightiest of the Greeks after Achilles, but his bout with insanity has caused him to lose honor. For the ideal Greek male, one of the most common ways to gain honor was in battle, whether defeating the enemy or dying in his efforts to defend his country.
For some reason, Sophocles does not seem to offer Ajax the option of attacking the Trojans and gaining honor in that way. Accordingly, Ajax tries to regain his honor by killing himself with the sword of his enemy. According to the Homeric tradition established in Iliad 7, Ajax and Hector had exchanged gifts after their one-on-one duel in that book. Hector had given Ajax a sword. In Sophocles' play, the playwright has Ajax try to regain his heroic status by killing himself with his enemy's sword in enemy territory:
Then, this sword is firmly set in Trojan soil,
land of my enemy, freshly whetted
on the iron-eating sharpening stone. (Ian Johnston translation)
In contrast to Ajax, who lived his life in accordance with the traditional heroic code, Odysseus does something unprecedented in the realm of traditional Greek ethics: he forgives his enemy. After discovering the Ajax had tried to kill them, Agamemnon and Menelaus want to have Ajax put to death. After Ajax dies, Agamemnon and Menelaus want to deny Ajax burial. Odysseus, on the other hand, is willing to forgive Ajax, the man who tried to kill him, and he argues successfully that Ajax deserves a proper burial. Thus, near the play's conclusion, Ajax's half-brother Teucer says to Odysseus:
Of all the Argives, you were the one
who was his greatest enemy, and yet
you are the only one to stand by him,
to lend a helping hand.
At the play's end, Odysseus enhances his honor and his heroic status by granting his friend, who became his enemy, an honorable burial. In Sophocles' play, the tragedian explores heroism by contrasting Ajax and Sophocles.