In the United States, prosecutors are elected and are referred to as a District Attorney. However, many prosecutors are assistants to the District Attorney and are civil servants.
In the United Kingdom, prosecutors are barristers and are hired by the police. Although many barristers only do prosecution work, there is nothing in English criminal procedure that prevents a barrister from representing both the Crown (the State) on one occasion and defendants in criminal proceedings in another.
In Canada, prosecutors are all civil servants and are referred to as a Crown Attorney.
Prosecutors have a duty to put the interests of justice above winning a case. As such, they are bound by professional duty not to proceed with a prosecution if there is clear evidence that an individual is not guilty of a crime. They are also bound to disclose to the defence any evidence collected by the police that may exonerate the defendant or raise doubt about the defendant's guilt. Defence attorneys are not bound by the same conditions and may freely defend clients they know to be guilty as long as they do not mislead the court by presenting false evidence or presenting facts they know not to be true.