During World War II, Kurt Gerstein, a Waffen-SS officer employed in the SS Hygiene Institute, designs programs for the purification of water and the destruction of vermin. He is shocked to learn that the process he has developed to eradicate typhus, by using a hydrogen cyanide mixture called Zyklon B, is now being used for killing Jews and other "undesirables" in extermination camps. Gerstein attempts to notify Pope Pius XII about the gassings, but is appalled by the lack of response he gets from the Catholic hierarchy. The only person moved is Riccardo Fontana, a young Jesuit priest. Fontana and Gerstein attempt to raise awareness about what is happening to the Jews in Europe but even after Fontana appealing to the pope himself, the Vatican makes only a timid and vague condemnation of Hitler and Nazi Germany. Eventually Gerstein travels to Rome to speak to the Pope himself but when he arrives the Germans are taking control of Rome and begin rounding up the Italian Jews to be sent to concentration camps. Fontana begs the Pope to force the Germans to stop the deportation by appearing at the train station in person but the Pope refuses, saying that doing so will cause hardship for the Christians living under Nazi Germany. In disgust and sorrow Fontana puts a Yellow badge on himself and allows himself to be taken on the train of Jews going to the concentration camps. When he arrives at the camp Fontana is interrogated by the head of the camp, a 'friend' of Kurt Gerstein known simply as the Doctor, who despite knowing that the war is lost and that Fontana is a Catholic priest allows Fontana to stay with the Jews and be gassed. Gerstein attempts to save Fontana but he will not leave. The Doctor escorts Gerstein out of the camp after Fontana and most of the Jews are killed; they drive by German soldiers digging up and burning the bodies of Jews in a mass grave near the camp and the Doctor asks Gerstein if he knows any contacts to help get him out of Germany. Gerstein returns home and gathers all his evidence that documents the Nazi atrocities and takes them to the Allies. Despite accepting his evidence he is still arrested and after reading the charges against him he is found hanged in his cell. Afterward the Doctor is seen speaking to a Cardinal in Rome asking for help leaving the country saying "I'm a doctor, just a physician" and the cardinal agrees to help send him to Argentina. While the character of Kurt Gerstein is historical, the character of the young priest is fictional. Although based on the action of Gerstein to stop and bring global awareness to the Holocaust, the plot is largely fictitious.
The film is based on a 1963 play by Rolf Hochhuth, The Deputy, a Christian Tragedy, which was widely attacked in Catholic and Jewish circles for its portrayal of Pope Pius XII. The German-language version of the film was released under the play's original title Der Stellvertreter. Since the Holy See did not allow filming in the Vatican, the scenes in the papal palaces were shot in the Palace of the Parliament of Bucharest, Romania.