The final witness for gays and lesbians seeking to overturn California's ban on same-sex marriage testified Friday that most people don't choose their sexual orientation, few people change it and "conversion therapy" is useless and potentially harmful.

"The vast majority of people are consistent in their (sexual) behavior, their identity and their attractions," Gregory Herek, a UC Davis psychology professor, said at the San Francisco federal court trial on the constitutionality of Proposition 8.

He said 95 percent of the self-identified gay men in a study he conducted, and 80 to 90 percent of the lesbians, believed they had little or no choice in their sexual orientation. Gays and lesbians commonly have heterosexual partners at some point in life - typically due to youthful uncertainty and social pressures - but most people ultimately can define their own sexuality, Herek said.

The plaintiffs, two same-sex couples and the city of San Francisco, offered his testimony to counter arguments by Prop. 8's defenders that sexual orientation is changeable and impossible to define. As a consequence, Prop. 8's supporters contend, prohibiting same-sex marriage can't be discriminatory because any Californian can still wed someone of the opposite sex.

Howard Nielson, a lawyer for the Prop. 8 campaign, hammered on that point during a cross-examination that stretched over 5 1/2 hours, asking Herek about innumerable studies that described sexual orientation as complex and found that people's sexual identities are often flexible.

Herek said none of the studies contradicted his conclusions. The plaintiffs also quoted Daniel Robinson, an Oxford University philosophy professor who was originally on the pro-Prop. 8 witness list - and later withdrawn - as saying sexual orientation is not readily subject to change.

Chief U.S. District Judge Vaughn Walker, who is hearing the case without a jury, will also consider other justifications for the ballot measure - that it reaffirms the historic definition of marriage, promotes healthy child-rearing, and leaves gays and lesbians adequately protected by domestic-partner laws - before deciding whether it violates the constitutional guarantee of equal protection.

Prop. 8 amended the California Constitution in November 2008 to define marriage as the union of a man and a woman, overturning a May 2008 state Supreme Court ruling that allowed gays and lesbians to marry.

In two weeks of the nation's first federal court trial on same-sex marriage, the plaintiffs have presented testimony from both couples - two gay men from Burbank and two lesbians from Berkeley - and others on the personal impact of Prop. 8 and the campaign to pass it.

One plaintiff, Paul Katami, recalled seeing campaign ads urging a yes vote to "protect the children" and wondering why any children would need protection from him. Another witness, Bay Area author Helen Zia, described the acceptance she felt after marrying her longtime partner after the state Supreme Court ruling and hearing her bride's father, on his deathbed, refer to her as "my favorite daughter-in-law."

Opponents of Prop. 8 largely have relied, however, on academic witnesses to make their case that gays and lesbians suffer from ongoing discrimination and that there is no justification, other than prejudice, for excluding them from marriage.

Witnesses have testified, for example, that marriage in the United States has been based on voluntary consent and an evolving concept of equality and free choice; that the rationales for Prop. 8 are similar to the justifications once used for banning interracial marriage; that children fare just as well with same-sex and opposite-sex parents; and that gays and lesbians, despite some recent gains, have little political power in an era of ballot initiatives.

Lawyers for the Prop. 8 campaign have questioned the witnesses at length, suggesting that they are biased advocates and that their findings contradict data from European countries that have legalized same-sex marriage.

The defense plans to present its own experts early next week on political power and the benefits of opposite-sex marriage. Walker said he will examine the evidence for several weeks before scheduling final arguments.