Five out of seven openly gay candidates running for seats in the California Assembly advanced in Tuesday's Democratic primary.

One candidate's loss was too narrow to call until Wednesday morning.

Michael Wilson, a Vallejo City Councilman, lost out to Santa Rosa Planning Commissioner Michael Allen by a scant 520 votes in his bid for the 7th Assembly District, which includes parts of Solano, Napa and Sonoma counties.

Gay rights advocates faced a second – but expected – loss in the fight to represent the people of California's 53rd District. Mitch Ward barely scraped up sufficient votes to place third in a crowded race.

Ward is among the 18,000 gay and lesbian couples who married in California during the brief May-to-November 2008 window when gay marriage was legal in the state. He had positioned himself as a strong advocate for repeal of Proposition 8, California's voter-approved gay marriage ban.

Of the five candidates that advanced Tuesday, two are incumbents and expected to remain in office, while the other three candidates are running in districts that heavily favor Democrats.

Assemblyman Tom Ammiano, 68, is widely expected to continue representing the voters of District 13, the majority of which is in San Francisco, although he will face a Republican opponent in the fall. Assembly Speaker John Perez of Los Angeles, on the other hand, is running unopposed.

Rich Gordon, the current president of the San Mateo County Board of Supervisors, narrowly won a three-person race for Assembly District 21 that remained too close to call Tuesday night. But final tabulations Wednesday morning confirmed Gordon, 61, will face Republican Greg Conlon and Libertarian Ray Bell in the fall for the chance to replace termed-out Democrat Ira Ruskin of Redwood City.

Democrats outnumber Republicans nearly 2-to-1 in the 21st District, which includes parts of San Mateo and Santa Clara counties.

San Diego councilwoman and small businesswoman Toni Atkins faced no competition in Tuesday's Democratic primary. She'll face Republican Ralph Denney in the fall for Assembly District 76.

In 2006 and again in 2008, San Diego businessman Denney challenged Assemblywoman Lori Saldana for the seat. The incumbent Saldana, however, handily won both races.

The biggest surprise came in the Los Angeles-area Assembly District 50 race where Ricardo Lara was facing three strong candidates for the Democratic nomination.

Lara was accused of being a “machine candidate and a carpetbagger” by opponents after he received the backing of Los Angeles Mayor Antonio Villaraigosa and leading labor unions.

The son of Mexican immigrants, Lara says he'll work hard to make college education for immigrant students more affordable.

Four of the candidates – Perez, Atkins, Wilson and Lara – have the endorsement of the Gay & Lesbian Victory Fund, a group that supports openly gay elected officials, but Ammiano does not. California's largest gay advocate, Equality California, has endorsed all five candidates.