She subsequently worked as a deputy district attorney (1990–98) in Oakland, earning a reputation for toughness as she prosecuted cases of gang violence, drug trafficking, and sexual abuse. Harris rose through the ranks, becoming district attorney in 2004. In 2010 she was narrowly elected attorney general of California—winning by a margin of less than 1 percent—thus becoming the first female and the first African American to hold the post. After taking office the following year, she demonstrated political independence, rejecting, for example, pressure from the administration of Pres.