SAN FRANCISCO — Dealing another legal setback to anti-gay-marriage forces, a federal judge on Tuesday rejected arguments that a former colleague’s same-sex relationship rendered him biased when he struck down California’s ban on same-sex nuptials last year.

In a 19-page ruling, Chief U.S. District Judge James Ware refused to set aside former Chief Judge Vaughn Walker’s ruling invalidating Proposition 8, concluding that a judge can fairly decide a struggle over gay rights even if he is gay and involved in a long-term relationship.

Ware disagreed with Proposition 8’s sponsors, who maintained that Walker had an inherent bias because he stood to gain the right to marry if the voter-approved ban on same-sex marriage was thrown out.

“The presumption that Judge Walker, by virtue of being in a same-sex relationship, had a desire to be married that rendered him incapable of making an impartial decision, is as warrantless as the presumption that a female judge is incapable of being impartial in a case in which women seek legal relief,” Ware wrote.

“On the contrary,” he continued, “it is reasonable to presume that a female judge or a judge in a same-sex relationship is capable of rising above any personal predisposition and deciding such a case on the merits.”

Proposition 8 backers vowed to appeal the decision.

“The (Proposition 8) legal team obviously disagrees with (the) ruling,” said attorney Charles Cooper, and will continue “to defend the will of the people … to preserve marriage as the union of a man and a woman.”

Gay rights advocates had stronlgy criticized the effort to disqualify Walker from the case because of his 10-year relationship with a male doctor, saying it was an act of desperation.

“Gay judges, lesbian judges, are entitled to the same fairness and impartiality presumptions as all other judges,” said Theodore Boutrous Jr., a lawyer for same-sex couples.

The 67-year-old Walker, who retired earlier this year, declined comment.