Benjamin Castaneda pleaded guilty to two felony counts of attempting by threats to deter an executive officer from performing a lawful duty, and pleaded no contest to a misdemeanor count of making criminal threats.
He is expected to be sentenced to three years' probation when he returns to court on Aug. 7.
Deputy Attorney General Peter Flores said Castaneda threatened Gascon in a Facebook post about the district attorney's prosecution of cases against him and his brother for allegedly violating restraining orders filed by other family members.
The Facebook post did not make a direct threat against Gascon, but Flores said it contained something to the effect of, "Back off of the cases or something bad is going to happen."
The state attorney general's office handled the threats case because Gascon was involved as a victim.
Castaneda's attorney, Deputy Public Defender Vilaska Nguyen, declined to comment on the case outside of court Tuesday.
According to the Department of Elections, Castaneda filed a declaration of intent to run for supervisor in District 9 last October. The district is currently represented by David Campos, who is running for re-election.
Upon his release from jail, Castaneda will be turned over to the supervision of the city's behavioral health court for mental counseling, Flores said.