A defendant who claims to be innocent but doesn't want to risk going to trial can sometimes take what has become known as an Alford plea, named after the Supreme Court's decision in North Carolina v. Alford (400 U.S. 25 (1970).) But not all states allow this type of plea, and even when they do, judges don't have to accept the plea.
In an Alford plea, a defendant pleads guilty while maintaining innocence.
Henry Alford was a North Carolina man accused of murder. He insisted that he was innocent of the charges but decided to take a plea to second-degree murder rather than face the chance of being convicted at trial and receiving the death penalty.
On appeal, one of the appellate courts held that his plea was involuntary because it was coerced by the threat of the death penalty. But the Supreme Court stepped in, finding not only that the threat of the death penalty didn't make the plea involuntary, but also that a defendant who claims to be innocent can plead guilty under appropriate circumstances.
The Court found the plea valid as long as there is a "factual basis" for it (such as the witness testimony) and it's "knowing, voluntary, and intelligent" (essentially meaning that the defendant made a rational decision to plead guilty).
It's important to keep in mind that the Supreme Court held that pleas like the one in Alford are allowed under the Constitution—it didn't hold that states are required to accept such pleas.
Alford pleas are similar to no contest (or nolo contendere) pleas. Whereas an Alford plea means the defendant pleads guilty while maintaining innocence, a no contest plea means the defendant accepts the conviction but doesn't admit guilt. In the no contest plea situation, the defendant acknowledges that the prosecutor has enough evidence to convict.
Both an Alford plea and no contest plea result in a conviction, and they avoid the costs and uncertainties of going to trial. A defendant might want to use an Alford plea to avoid trial or a severe penalty. No contest pleas often come into play when the defendant faces a related civil trial and doesn't want an admission of guilt on the record.
If an Alford plea is an option for you, it's still very important to seek the advice of an attorney before entering into or accepting any type of plea deal. Laws regarding the available pleas, their requirements, and their implications vary from place to place. An attorney familiar with the laws of your jurisdiction will be able to help assess your options.