(CNN) Roy Moore, the Republican nominee for Senate in Alabama, ruled in a 1990s divorce case that a woman who had a lesbian affair couldn't visit her children unsupervised or with her partner, writing that the "minor children will be detrimentally affected by the present lifestyle" of the mother.

Moore, then a circuit judge, was ultimately removed from the case by an Alabama appeals court after the woman and her attorneys argued that he couldn't be impartial because of his views on homosexuality, according to public court documents reviewed by CNN's KFile.

The case took place years before Moore garnered national attention for his public battle over a Ten Commandments statue and his more recent refusal to enforce the Supreme Court's ruling allowing same-sex marriage nationwide, both of which resulted in Moore's removal from the Alabama Supreme Court. It offers an early glimpse of how Moore's interpretation of the Bible and morality would inform his decisions as a public official.

After sweeping Democratic victories in elections held Tuesday, national attention will now turn to the Alabama Senate race, where Moore faces Democratic nominee Doug Jones in a special election to be held on December 12.

Representatives for Moore did not return requests for comment on this story.

In January 1996, Moore was presiding over a divorce case between Suzanne Scott Borden and her estranged husband. Borden and her attorneys, Laura Alfano and Janice Hart, initially asked Moore to recuse himself from the case because of his views on homosexuality. Borden's lawyers argued that, because of his "deeply fundamentalist religious faith," Moore had a "strong preconceived opinion of the Plaintiff because of her sexual orientation which would not leave the Court's mind perfectly open to conviction and would render the Court unable to exercise his functions impartially in this particular case."

Borden's lawyers also noted that one of them had previously worked with the ACLU, which was suing Moore at the time over his public display of the Ten Commandments in his courtroom.

Moore denied their motion to recuse himself and would go on to issue a temporary ruling that gave the father custody of the Bordens' two young children and ordered the mother to pay $126 a week in child support. He also barred Borden from visiting her children unsupervised, overnight or in the presence of her partner.

"The court strongly feels that the minor children will be detrimentally affected by the present lifestyle of [Mrs. Borden] who has engaged in a homosexual relationship during her marriage, forbidden both by the laws of the State of Alabama and the Laws of Nature," Moore wrote in his ruling.

Borden and her attorneys would go on to take their request for Moore's recusal to the Alabama Court of Civil Appeals. Borden's lawyers again cited Moore's public statements about homosexuality as evidence of his "personal bias and prejudice against the Plaintiff." In the appeal, Borden's attorney's referred to an affidavit Borden submitted in July of 1996 alleging that she heard Moore condemning gay people in a conversation with a man she did not know while she was sitting outside his office.

Borden quoted Moore as saying, "This goes to show that this is evil. They are wrong and of Satan."

Moore denied that he made the remark and fought the effort to have him removed from the case.

"Well, as you said, you know, homosexuality is against law," Moore said, according to the court documents. "Murder is against the law. I don't recuse for every criminal that comes up, and I'm not comparing criminality with this conduct, but if somebody that commits a murder comes up before my court, I'm not going to recuse them, because that's against what I believe, and it's also against the law. Homosexuality is against the law. I can't recuse, just because homosexuality is against the law."

The case drew attention from local activists, gay rights groups, and local media, as Moore opened the trial. Moore's longtime political ally, Dean Young, led a rally outside the courthouse while Borden attempted to remove Moore.

"Either get your lives straight or get back in the closet where you came from,'' Young was quoted by the Associated Press as saying at the courthouse rally.

Ultimately, the Court of Civil Appeals agreed with Borden and her attorney's that Moore should be taken off the case.

Moore appealed the court's decision to the state's Supreme Court.

"In Alabama homosexuality is wrong," Moore's lawyer, Stuart J. Roth told Liberty Magazine during that appeals process. "Whether a judge is a Christian or a Jew or a Muslim or an atheist, breaking the law is a factor."

In 1997, the Alabama Supreme Court ordered the case be reheard without Moore. The case was reassigned to Etowah County Circuit Judge William Rhea. Rhea closed the trial to the public immediately after taking over the case following requests from lawyers for Mr. and Mrs. Borden, who argued the divorce was case was supposed to be about the interests of the children.

Borden did not respond to requests for an interview by CNN's KFile. Her attorneys, Alfano and Hart, told CNN's KFile in a phone interview the case left them with a low opinion of Moore.

"I think he abuses the law for his own advantage," Hart said.

"He doesn't follow the law if it suits him not to," Alfano added.