After a lifetime of serving Athens in the military and as a philosopher, Socrates was accused by Meletus, an Athenian poet, of corrupting the youth of the city and of "making the worse appear the better." Athens at the time was a deeply religious society, and Meletus went so far as to accuse Socrates of being an atheist. For many years, Socrates had irritated Athenians by questioning their preset assumptions about everything. He even nicknamed himself "the gadfly" for his ability to sting people's sensibilities. Socrates' students were young men who had chosen to learn from him of their own accord, and apparently they had adopted his method of questioning others' assumptions, to the great irritation of their elders.
Socrates was tried before an Athenian jury; much like today, those who sat on the jury were compensated for their time. Since Athens was a pure democracy, the jurors themselves presided over the trial with no judge to impose his authority. By agreeing to be tried by his fellow Athenians, Socrates was basically putting his life in their hands. The jury first voted and found Socrates guilty of the accusations leveled against him and then voted to impose the death penalty.
Socrates' "Apology," which was written at a later date by Plato, forms the most famous piece of the trial. The "Apology" is essentially Socrates' defense of himself and his response to the jury after it found him guilty and sentenced him to death. Notably, Socrates is not at all apologetic in this speech but proudly defends his teaching methods and his lifetime in service of the truth. He even employs his Socratic method of teaching by questioning his accuser, Meletus, and manages to induce Meletus to admit that it would make no sense for Socrates to corrupt the youth of the city. If he intentionally corrupted the youth, Socrates argues, he would in the end be making his own city a worse place for him to live, and this would be counterintuitive.
Despite the pleas of his friends and followers that he flee, Socrates chose to stay in Athens and accept his sentence and died by drinking poisonous hemlock as he had been ordered. Many view "The Trial and Death of Socrates" as a document of dubious historical accuracy and suspect that Plato tried to show his departed teacher in the best possible light and possibly omitted evidence that showed Socrates' worse side. Others argue that Socrates, by submitting to death by the judgment of his peers, was not actually condemning democracy but showing his allegiance to it. "The Apology" shows a Socrates who is unshakably convinced throughout his trial that justice is on his side and that he goes to die for a just cause.