Common sexual practices remain illegal in Maryland, Virginia and 22 other states under sodomy laws similar to the one the D.C. Council voted to repeal this week.

Critics of sodomy laws say they are used largely to discriminate against gay men and lesbians, but most of those laws also apply to heterosexuals.

James Moseley thought sodomy laws applied only to homosexuals. Charged with sexually assaulting his estranged wife, the Georgia carpenter testified at his trial that she willingly had oral sex with him.

The jury acquitted Moseley of rape, but found him guilty of consensual sodomy. He was sentenced to five years in prison and served 18 months before being freed in August 1989.

"I had no idea that I was incriminating myself," said Moseley, now 38.

Although sodomy prosecutions are rare, they do occur, against both homosexuals and heterosexuals. In North Carolina, a heterosexual man was sentenced to 10 years in prison and served two for having oral sex with a woman in 1988. A Maryland man was sentenced to 18 months' probation for heterosexual sodomy in 1986. And in 1988, a female Marine corporal was imprisoned for six months at the Quantico Marine Corps Base for having oral sex with a woman.

Groups lobbying for repeal of sodomy laws across the country say that the laws provide the underpinnings for discrimination against gay men and lesbians in a wide range of areas, including employment, child custody and housing. Defenders of the laws counter that they rightly stigmatize homosexual activity, which many heterosexual Americans consider immoral.

The District's vote is the latest in a long line of such repeal votes across the country. If the vote is not overturned by Congress, which blocked repeal by the District in 1981, it would be the first legislative repeal of a sodomy law in a decade. Wisconsin, in 1983, was the last state to repeal a sodomy ban.

Sodomy originally was banned in every state, but since 1961 the laws have been repealed or ruled unconstitutional in 26 states. Nine states have narrowed their laws to apply only to homosexuals.

Some sodomy laws retain "crime against nature" language; most outlaw oral and anal sex between consenting adults. The majority make sodomy a felony carrying a wide range of maximum prison sentences, including 10 years in Maryland and 20 in Virginia.

Opponents of the laws, rooted in religious prohibitions on nonreproductive sexual activity, say they are anachronistic bans on behavior that surveys show is extremely common among both gay people and heterosexuals.

"The evidence suggests that oral sex is practically universal in the United States, particularly among people under 50," said June Renish, director of the Kinsey Institute at Indiana University in Bloomington. She also estimated, based on 40 years of surveys, that four of every 10 heterosexuals have at least tried anal sex.

Opponents say the laws are rarely used except in failed rape prosecutions and to provide legal justification for discriminating against homosexuals.

"Sodomy laws are used to say that gay people are criminals and, therefore, not entitled to constitutional protections," said Arthur Leonard, New York Law School professor and author of "Sexuality and the Law."

The tendency of judges to equate homosexuality with sodomy cost one Virginia father the custody of his 9-year-old daughter. Alexandria lawyer James Lowe said the man was a CIA employee who lived with his longtime lover.

After the man's ex-wife sued to regain custody of their daughter, the Virginia Supreme Court ruled in 1985 that "the conduct inherent in the father's relationship is punishable as a . . . felony." His daughter was forbidden to visit his home or to see him in the presence of his lover.

Gay rights lawyers say sodomy prosecutions can be arbitrary. For example, most gay people in the military are discharged, not imprisoned, if their sexuality is discovered, but Barbara Baum was not so lucky.

Baum, a military police corporal, was convicted of sodomy in 1988. Charges were brought, Baum said, after her lover's ex-boyfriend kicked in the door of their motel room and found her in bed with the woman. Baum was imprisoned for six months at Quantico.

District lawyer Michelle Benecke, who later wrote about the case, said she believes Baum was imprisoned to "send a message" to other women stationed with her at Parris Island, S.C., who were not cooperating with a wide-ranging probe of lesbianism. Benecke said that ultimately 27 women were booted out and that three, including Baum, were jailed.

In Maryland, at least four attempts to repeal the sodomy law have failed in the General Assembly, most recently in 1988. In 1990, the Maryland Court of Appeals declared that the statute does not apply to private, heterosexual activity.

In making that ruling, Maryland's top court threw out the 1987 sodomy conviction of Steven A. Schochet, a Montgomery County man who had received five years' probation. He had been acquitted of raping a Wheaton woman in her apartment in 1986.

The 1990 ruling means that Maryland's sodomy law applies only to gay people, although the statute refers to "every person" who commits prohibited sex acts with "any other person."

A gay rights lawsuit challenging the constitutionality of Virginia's sodomy law, which applies to gay people and heterosexuals, was rebuffed by a special three-judge court in 1975.

Although Virginia's sodomy law is not limited to homosexuals, Virginia State Police and Fairfax County police say the law prevents them from hiring gay men or lesbians.

In Texas, Mica England, a lesbian, is suing the Dallas police over a similar rule and has won several rounds in court. She said she has learned "how difficult it is to make people understand we're just like they are. We're not perverts."

The use of sodomy laws to justify not hiring homosexuals is only one example of how the laws are used to discriminate against gay people, gay rights advocates say. The laws also are used as a rationale for statutes outlawing gay marriage and, in some places, gay adoption.

Similarly, the Bush administration, in one of its last official acts, argued in court in December that the military's sodomy law is reason to keep the ban against homosexuals in the armed services, even though that law applies to heterosexuals as well.

The best-known defender of sodomy laws, at least as they apply to homosexuals, is Georgia Attorney General Michael Bowers, who said they are based on "the public's collective perception of morality."

"I think the majority of Georgians would find homosexual sodomy to be immoral," Bowers said, adding that he does not think heterosexual sodomy similarly offends Georgians' sensibilities.

Bowers successfully defended Georgia's sodomy law in Bowers v. Hardwick, a 1986 case in which the U.S. Supreme Court ruled 5 to 4 that the constitutional right to privacy does not extend to homosexual sodomy.

The case involved Michael Hardwick, a gay Atlanta bartender charged with having sex with another man in his bedroom. He was never prosecuted, but filed a challenge to the sodomy statute. The fact that he was not prosecuted or imprisoned apparently affected the swing vote, cast by then-Justice Lewis F. Powell Jr.

Although Powell agreed with the majority that the sodomy ban violated no privacy right, he wrote that "a prison sentence for such conduct -- certainly a sentence of long duration -- would create a serious Eighth Amendment issue." That constitutional amendment outlaws cruel and unusual punishment.

After retiring, Powell said in 1990 that he had probably erred in voting to uphold sodomy laws, but he dismissed the Hardwick case as "frivolous," one brought "just to see what the court would do."

Since the Hardwick decision, foes of sodomy laws have concentrated -- with some success -- on trying to show that the laws violate state constitutions. Last September, the Kentucky Supreme Court overturned its state's homosexual-only sodomy law.

"We need not sympathize, agree with or even understand the sexual preference of homosexuals in order to recognize their right to equal treatment before the bar of criminal justice," the court wrote.

The highest court in Texas is expected to rule soon on a similar law, which lower courts have held unconstitutional.

In 1990 a judge in Wayne County, Mich., found his state's across-the-board ban on sodomy unconstitutional. (Because the decision was not appealed, it applies only to one county.) The ruling singled out the testimony of Verna Spayth, a disabled heterosexual in Ann Arbor, who said that post-polio syndrome prevents her from having traditional intercourse.

"It's real hard to tell yourself that people with disabilities shouldn't have sex because they can't in the one way that is legal here in Michigan," Spayth said in an interview.

Meanwhile, having become all too familiar with the reach of sodomy laws, Moseley, the carpenter, wants them eliminated.

"Now, I'm not in favor of homosexual activity, but who am I to say what two people {should} do in the privacy of their own bedroom?" said Moseley, who has moved to Tuskegee, Ala. "It's not my right to judge. It's God's right."