In yet another blow to embattled California Republicans, San Diego will have a Democrats-only November runoff to replace GOP Mayor Kevin Faulconer, who is termed out.

With all the votes finally counted in California’s second-largest city, Assemblyman Todd Gloria and Councilwoman Barbara Bry finished on top of the March 3 primary, with Republican Scott Sherman in third, about 1,200 votes behind Bry.

Gloria, who collected about 41% of the vote, will be the likely favorite in November.

City elections are officially nonpartisan, but the key word there is “officially.” San Francisco mayors like Gavin Newsom, Willie Brown and Dianne Feinstein were first and foremost Democrats, with nothing nonpartisan about them.

The Democratic primary sweep means that come 2021, the party will hold the top post in California’s four largest cities — Los Angeles, San Diego, San Jose and San Francisco — and in seven of the top 10. Fresno, the state’s fifth-largest city, will keep its GOP leadership after electing a new Republican mayor last month. Bakersfield and Anaheim, numbers nine and 10 on the list of state cities, also are led by Republicans.

For decades, San Diego County was a GOP stronghold, its conservative complexion buoyed by a heavy Navy and other military presence. But as the state has grown bluer, so has San Diego. The Republicans’ 41% to 36% registration edge in 2000 fell to a virtual tie in 2010 and has dropped dramatically since then.

Going into the March election, Democrats held a commanding 38% to 28% registration lead in the county and an even wider 44% to 21% margin in the city of San Diego, which could make the March result a dismal sign for the GOP’s future there.

John Wildermuth is a San Francisco Chronicle staff writer. Email: jwildermuth@sfchronicle.com Twitter: @jfwildermuth