What Is a “morally Ambiguous Character”?

Morally ambiguous characters are difficult to classify as either good or evil, as they contain strong elements of both. This type of character can be used as either a hero or a villain, though stories with a morally ambiguous central hero are generally tragedies.
Stories with morally ambiguous characters have built-in tension, because there is always the question of whether their evil nature will be able to take hold, causing them to fail in their quest. These characters generally have real problems causing their inner conflicts, which also makes them sympathetic.
The classic example of moral ambiguity is Hamlet. A more modern example is Dirty Harry, who was willing to perform evil acts to accomplish good deeds. These characters are constantly negotiating the edge between good and evil.