Why was Socrates put on trial?

I’ve recently watched a couple of programmes on Channel Four called “Athens: The truth About Democracy”. These programmes were presented by historian Bettany Hughes who would make any programme watchable.
In fact, the subject matter itself was fascinating and the most intriguing question raised was why, in a society enjoying more freedom and democracy than any the world had ever seen, would the 70-year-old philosopher Socrates be tried and be put to death for what he was teaching? The trial of Socrates raises enough interest even today to fill a web site and Bettany Hughes is currently writing a book on Socrates.