Kansas (search) cannot punish illegal underage sex more harshly if it involves homosexual conduct, the state's highest court ruled Friday in a case watched by national groups on both sides of the gay rights debate.

The Supreme Court sided in a unanimous decision with convicted sex offender Matthew R. Limon (search). In 2000, he was sentenced to 17 years and two months in prison because, at 18, he performed a sex act on a 14-year-old boy. Had one of them been a girl, Limon could have faced only 15 months behind bars.

The court High ordered Limon resentenced as if the law treated illegal gay sex and illegal straight sex the same. The court struck language from the law that resulted in the different treatment.

A lower court had said the state could justify the harsher punishment as protecting children's traditional development, fighting disease or strengthening traditional values.

Writing for the high court, Justice Marla Luckert said the Kansas law specifying harsher treatment for illegal gay sex is too broad to meet those goals.

"The statute inflicts immediate, continuing and real injuries that outrun and belie any legitimate justification that may be claimed for it," Luckert wrote. "Moral disapproval of a group cannot be a legitimate state interest."

National health groups and the National Association of Social workers filed legal arguments supporting Limon's position. A conservative law group, Orlando, Fla.-based Liberty Counsel, helped prepare written arguments from 25 legislators in support of the law.

Both Limon and the other boy, identified only as M.A.R. in court documents, lived at a Paola group home for the developmentally disabled. In court, an official described M.A.R. as mildly mentally retarded and Limon as functioning at a slightly higher level but not as an 18-year-old.

Limon's attorneys described the relationship with the younger boy as consensual and suggested that they were adolescents experimenting with sex.

Attorney General Phill Kline's office has repeatedly described Limon as a predator, noting he had two similar, previous offenses on his criminal record. Kline contended that such a pattern of behavior warranted a tough sentence and that courts should leave sentencing policy to the Legislature.

Kline's office had no immediate comment to the ruling.

Kansas law makes any sexual activity involving a person under 16 illegal, regardless of the context.

But Limon's attorneys note that had his victim been female, the state's 1999 "Romeo and Juliet" law would have applied. It establishes lesser penalties for illegal sex when the partners' ages are within four years and one partner is under 19 -- and specifically applies only when the partners are of the opposite sex.

In Friday's decision, the court said the "Romeo and Juliet" law was intended to allow less harsh treatment of consensual teenage relationships. Luckert wrote that purpose wouldn't be harmed by striking the language limiting the law to only opposite-sex partners. She wrote that the language "suggests animus toward teenagers who engage in homosexual sex."

The Kansas Court of Appeals rejected Limon's appeal in 2002. The next year, the U.S. Supreme Court struck down a Texas law criminalizing gay sex and returned Limon's case to the state courts.

But in a 2-1 decision in January 2004, the Kansas Court of Appeals (search) noted the U.S. Supreme Court case involved consenting adults and sided with the state again. Limon then appealed the Kansas Supreme Court.