The Virginia Supreme Court today ordered a Fairfax County homosexual to surrender custody of his 10-year-old daughter, saying the man was an unfit guardian because he had continuously exposed his child to an "immoral and illicit relationship" with his lover.

The court gave sole custody of the daughter to her mother and forbade the father from having his child visit at his home as long as he and his lover live together. The ruling also directed the father not to allow the child to meet with him and his lover.

The opinion reversed the August 1983 ruling of a Fairfax County Circuit Court judge who allowed the 33-year-old man to retain custody of the daughter, whom he helped rear since infancy. Judge Richard J. Jamborksy, in a ruling that was praised by gay rights groups, said that the child's mother had failed to prove allegations that her ex-husband's homosexual life style had a detrimental impact on the child.

The seven-member state Supreme Court disagreed sharply in its unanimous ruling, noting that, under Virginia law, homosexual conduct is "a class six felony" punishable by a prison sentence of up to five years and a fine of up to $1,000. "We have no hesitancy in saying that the conditions under which this child must live daily are not only unlawful, but also impose an intolerable burden upon her by reason of the social condemnation attached to them," the court said.

"It's an outrageous decision, a tremendous setback to gay rights," said Joe Tom Easley, cochairman of Lambda, a national gay rights organization based in New York. "It is the sort of thing we have come to expect of the Virginia courts. In terms of their attitudes towards gay people, it is one of the worst in the country."

An attorney for the mother, identified in court by the fictitious name "Catherine Roe," was elated by the decision and said he would begin making immediate arrangements to have the girl reunited with her mother and set guidelines for the father's visitation rights.

"Even representing the mother, I think he has been a good father," said Richard Byrd, a Fairfax County lawyer. "He's done everything a father could do, given he wanted to be a homosexual."

Andrew Melts of Alexandria, one of the attorneys representing the father, identified in court as "David Roe," said he did not know whether his client would appeal the ruling. "Obviously he's going to be upset; he's going to want to maintain a relationship with his daughter," Melts said.

The Supreme Court ruling today focused on the father's homosexual relationship and noted that the mother had alleged the child had seen the two men "hugging and kissing and sleeping together" and that other homosexuals visited the home.

"The child's awareness of the nature of the father's illicit relationship is fixed and cannot be dispelled . . . . " the court said in its seven-page ruling. "The impact of such behavior upon the child, and upon any of her peers who may visit the home, is inevitable. . . .

"The father's continuous exposure of the child to his immoral and illicit relationship renders him an unfit and improper custodian as a matter of law."

The number of homosexual fathers fighting for child custody rights is growing nationally, according to gay rights activists. However, because custody cases are confined to local courts and cannot go to the federal court level, it is difficult to discern a trend in the courts' decisions, they said.

The daughter has lived with her father for the past six years, spending summers and holidays with her mother. Jamborsky's 1983 ruling on the mother's request for custody was believed to be the first time a Virginia judge had given a homosexual man custody of his child over the objections of the mother.

Jamborsky said in that ruling that he was allowing the father to maintain custody of the child partially because of the mother's health problems.

The mother's battle with cancer left the daughter with an obsession about death, Jamborsky said. He also noted that even though the mother had a lung removed because of cancer, she continued to smoke a pack and a half of cigarettes a day.

Jamborsky noted that "the father was always there like a rock, providing the necessary help" for the child, but he questioned whether the mother was "putting herself in a position to be a strong and continuing influence on this child's life."

Jamborsky ruled that the daughter could continue to live with her father as long as the father did not share a bed or bedroom with his male lover. The mother's attorney, Byrd, argued that the order would be virtually impossible to enforce.