The Episcopal Diocese of California averted another churchwide showdown over the role of gays in their denomination when delegates rejected three openly gay candidates Saturday.

The diocese chose the Rt. Rev. Mark Handley Andrus of Birmingham, Ala. on the third ballot. Andrus, who was chosen to replace the retiring Rev. William Swing, is married and has two college-age daughters.

The packed Grace Cathedral erupted with cheering and applause when the announcement was made.

The vote was closely watched by Episcopalians across the nation and their fellow Anglicans worldwide, who have been struggling to remain unified despite deep differences over gay clergy.

The gay candidates were the Rev. Canon Michael Barlowe of San Francisco, the Very Rev. Robert Taylor of Seattle and the Rev. Bonnie Perry of Chicago. Perry withdrew her candidacy before the final vote. All three have same-sex partners.

The 77 million-member Anglican Communion, represented in the United States by the Episcopal Church, is still reeling from the 2003 election of the first openly gay Episcopal bishop -- V. Gene Robinson of New Hampshire.