The 2010 California Attorney General's election, a contest between San Francisco DA Kamala Harris and Los Angeles DA Steve Cooley was the Closest statewide election in California in 2010, with Cooley—seen as Republican's best statewide chance that year—losing by an extraordinarily close 0.8%
Here, Cooley's record and Base of support in Los Angeles County provided a tough Race for Harris who—after besting a wide primary field—despite a bevy of negatie attacks against her—became the democratic nominee for the office
However, Harris still faced a stiff challenge from Cooley—who led her by a few points in public polling throughout the campaign.
Cooley's campaign did so by seeking to portray Harris as a weak on crime leftist, focusing on her decision not to pursue the death penalty against a gang member who shot and killed San Francisco police officer Isaac Espinoza.
As well as Harris' advocacy for reforms to incarceration practices and her overall opposition to the death penalty
This attack was countered by Harris by saying that there were a lot of criminals that were in jail because of her actions in the court room prosecuting them.
However, during one of the debates, Cooley complained about the Attorney General's salary, indicating that he would accept the pension from being LA DA whilst serving as attorney general because of it—leading harris to put this answer in an advertisement that prooved to be effective.
In the end, Harris would end up winning, serving 1 and a half terms before being elected to the Senate, and eventually the vice presidency in 2020.
Despite the close result, Cooley would end up blaming his loss on partisanship, noting he had won in LA County in Non-partisan elections but that the difference vs the other contests in a partisan race was too much to make up.