ATLANTA - A former high school football star who became a national symbol for the extremes of getting tough on sex offenders was ordered released from prison Monday by a judge who called his mandatory 10-year sentence for consensual teen sex "a grave miscarriage of justice.''

But the joy felt by Genarlow Wilson's family rapidly turned to disappointment as Georgia's attorney general announced he would appeal, a move that will keep the honour student behind bars for now.

Wilson's sentence was widely criticized as being too severe, even by members of the jury that convicted him and the author of the 1995 law that put him behind bars.

His case became a cause celebre that grew from local blogs and TV stations to national news shows and editorial pages. Some supporters, including former president Jimmy Carter, have said it raised questions about race and the criminal justice system. Wilson and five other males charged in the case are black, as are the two teenage girls involved.

"As far as I'm concerned, this case is a throwback to Southern justice,'' said state Senator Vincent Fort, an Atlanta Democrat.

Wilson, homecoming king of his school who was being recruited to play football at Vanderbilt University, has served more than two years of a mandatory 10-year sentence for aggravated child molestation. He was captured on videotape having consensual oral sex with a 15-year-old girl in 2003 when he was 17.

If the sentence stands, he would also be placed on Georgia's sex offender registry.

At the time of his crime, Wilson would have faced just one year in prison if he had sexual intercourse with the girl. The "Romeo and Juliet'' exception in Georgia law also would have allowed him to avoid the sex offender registry.

Legislators last year voted to close that loophole. But the state's top court said the new law could not be applied retroactively to Wilson, now 21.

Opponents of Wilson's release said it could open a floodgate for other cases. Georgia prisons currently hold 189 inmates who were sentenced for aggravated child molestation when they were 21 or younger.

Of those, 56 per cent were white and 44 per cent black, state figures show.

Black community leaders planned a protest outside Attorney General Thurbert Baker's office late Monday. Baker, who is black, is now pushing to keep Wilson in prison, arguing that his sentence is valid.

In his notice of appeal, Baker argued that Georgia law does not give a judge authority to reduce or modify the sentence imposed by the trial court. He said he would seek an expedited ruling from the Georgia Supreme Court. And he noted that a plea deal is on the table that would release Wilson in a maximum of five years and also remove him from the sex offender registry.

Not good enough, said Wilson's lawyer, B.J. Bernstein.

"It is really ridiculous when you consider that we had a judge that just said it is a misdemeanour that carries no sex offender registration,'' she said.

"It is extremely, extremely disturbing that the attorney general would take this action now.''

Bernstein said her office was seeking bond for Wilson, which would allow him to leave prison while the appeal is pending.

The judge's ruling Monday threw out Wilson's 10-year sentence and amended it to misdemeanour aggravated child molestation with a 12-month term, plus credit for time served, and he would not be required to register as a sex offender.

"The fact that Genarlow Wilson has spent two years in prison for what is now classified as a misdemeanour, and without assistance from this court, will spend eight more years in prison, is a grave miscarriage of justice,'' wrote Judge Thomas H. Wilson, who is no relation to Genarlow Wilson.

"If this court or any court cannot recognize the injustice of what has occurred here, then our court system has lost sight of the goal our judicial system has always strived to accomplish ... justice being served in a fair and equal manner,'' the judge wrote.

When the judge's order arrived Monday morning, Wilson's lawyers applauded and hugged his mother, Juannessa Bennett, who wiped away tears.

"I just feel like a miracle happened,'' Bennett said.

After the notice of appeal she looked stricken.

"It's heartbreaking,'' Bennett said.

Wilson's prominent supporters included Dallas Mavericks owner Mark Cuban, who declared he would boycott Georgia until Wilson was free, and Carter, who wrote a letter in support of Wilson to the state attorney general.

The court battle over Wilson's fate also drew comparisons to the rape charges levelled against Duke University lacrosse players last year, with critics saying prosecutors in both cases overreached.

Wilson was also charged with rape for being one of several male partygoers at a hotel to have sex with another 17-year-old girl, but was acquitted. The party was captured on a videotape that was played for the jury.

The five other male partygoers took plea deals in the case. One of them has been released from prison and is now in college.