A district attorney is a public official (appointed or elected) who represents the state in criminal cases in a particular judicial district (although the actual case work is handled by deputy district attorneys). The deputy district attorneys are the state's lawyers for cases involving people who have been charged with violating the state criminal laws.
For example, the Los Angeles District Attorney's Office is responsible for prosecuting felony crimes throughout Los Angeles County. The district attorney's office is not responsible for prosecuting federal crimes; those are prosecuted by the U.S. Attorney General's Office. A district attorney is also referred to as a D.A. or a prosecutor. See also, Attorney General, City Attorney.