LBGT rights advocates are celebrating an appeals court ruling that overturned an Alabama law criminalizing consensual homosexual conduct.

The Alabama Court of Criminal Appeals unanimously ruled that the state's anti-sodomy law is unconstitutional, reports the Associated Press. Under the statute, consensual oral and anal sex was banned, however the court determined that the law criminalized homosexual activities.

The state attorney general's office brought the case to the appeals court after a jury failed to convict a defendant on the felony charge of first-degree sodomy in 2010. Instead, the defendant was convicted of the non-felony, "lesser-included offense" of sexual misconduct, according to the ruling in the case of Dewayne Williams vs. State of Alabama, reports USA Today.

According to the Human Rights Campaign, Alabama is one of a dozen states that still have laws prohibiting consensual homosexual sex on the books.

Susan Watson, executive director of the American Civil Liberties Union of Alabama, praised the ruling.

"Aiming to ban consensual sex is flat out wrong," she said Saturday. "A person's sexual orientation shouldn't matter. Consensual sex is consensual sex."

Ben Cooper, chairman for Equality Alabama, also lauded the ruling.

"Each and every person, no matter their sexual orientation or gender identity, is entitled to equal protection under the law," Cooper said in a statement. "The Alabama court's unanimous decision overturning the statute is a step in the right direction and makes us optimistic for future and ongoing equal rights through the continued elimination of unconstitutional provisions in our state's constitution that violate privacy and equal protections."

On Monday, prosecutor Michael Jackson said that he understood why the appeals court ruled against his argument, and that the decision would probably be upheld if appealed to the Alabama Supreme Court. However, he added that the victim is not getting a fair result because the sex in the case wasn't consensual, and that the state's sodomy law still applies in cases of forced sex.