Aguirre ran for San Diego City Attorney in 2004, in the midst of a financial crisis and investigations by the Securities and Exchange Commission. Scandal had erupted in the summer of 2003 over a pension deal that municipal employees received between 1996 and 2002. Workers were given increased benefits during this period, but the city did not contribute enough to municipal pension funds to cover the increased benefits. The resulting deficit of some $1.4 billion left the city’s finances in shambles and made it virtually impossible to issue municipal bonds. Aguirre ran as a "clean up the mess" outsider, with support from Democrats in the officially nonpartisan race, and won with 50.4% of the vote. A 2008 Wall Street Journal article praised Aguirre’s efforts to address the City of San Diego's hundreds of millions of dollars of unfunded pension liabilities.