Dohnányi worked at the Hamburg Senate for a short time and in 1929, began a career at the Reich Ministry of Justice, working as a personal consultant with the title of prosecutor to several justice ministers. In 1934, the title was changed to Regierungsrat. In 1932, he was adjutant to Erwin Bumke, the Imperial Court President, in which capacity he put together Prussia's lawsuit against the Empire, which Prussia had brought after the Preußenschlag, Franz von Papen's dissolution of the Prussian social-democratic government through an emergency decree in 1932. As an adviser to Franz Gürtner from 1934–38, Dohnányi became acquainted with Adolf Hitler, Joseph Goebbels, Heinrich Himmler and Hermann Göring. He had access to the justice ministry's most secret documents.
Resistance
Spurred by the murders of alleged plotters of the 1934 Night of the Long Knives, "legitimised" murders carried out on government orders, without trial or sentence, Dohnányi began to seek out contacts with German resistance circles. He made records for himself of the régime's crimes, so that in the event of a collapse of the Third Reich, he would have evidence of their crimes. In 1938, once his critical view of Nazi racial politics became known, Martin Bormann had him transferred to the Reichsgericht in Leipzig as an adviser. Shortly before the outbreak of World War II, Hans Oster called Dohnányi into the Abwehr of the Oberkommando der Wehrmacht. Led by Wilhelm Canaris, it quite quickly became a hub of resistance activity against Hitler. Dohnányi protected Dietrich Bonhoeffer from conscription by bringing him into the Abwehr with the claim Bonhoeffer's numerous ecumenical contacts could be useful for Germany. In 1942, Dohnányi made it possible for two Jewish lawyers from Berlin, Friedrich Arnold and, to flee with their loved ones to Switzerland, disguised as Abwehr agents. Altogether, 13 people were able to leave Germany without hindrance, thanks to Dohnányi's forgeries and operation known as U-7. Dohnányi covertly went to Switzerland to make certain the refugees would be admitted. He also ensured they received money to support themselves. During late February 1943, Dohnányi busied himself with Henning von Tresckow's assassination attempt against Hitler and the attempted coup d'état. The bomb that was smuggled aboard Hitler's plane in Smolensk after being carried there by Dohnányi, however, failed to go off. On 5 April 1943, Dohnányi was arrested at his office by the Gestapo on charges of alleged breach of foreign currency violations: he had transferred funds to a Swiss bank on behalf of the Jews he had saved. Among the transactions in question were ones with Jauch & Hübener. Both Bonhoeffer and Christel Dohnányi were also arrested, although she was released about a week later. Military judge Karl Sack, himself a member of the resistance, deliberately delayed Dohnányi's trial; however, in 1944, Dohnányi was delivered to Sachsenhausen concentration camp. His involvement in the 20 July Plot came to light after the plan failed. Also, the Gestapo found some of the documents he had earlier saved and hidden and decided Dohnányi was "the spiritual head of the conspiracy” against Hitler. On Hitler's orders, on 6 April 1945, he was condemned to death by an SSdrumhead court and executed two or three days later, hanged by piano wire.
After the fall of the Nazi régime, the chairman of the drumhead court, Otto Thorbeck, and the prosecutor, Walter Huppenkothen, were accused in West Germany of being accessories to murder. After the Bundesgerichtshof had at first quashed a lower court's two acquittals, it changed its mind in 1956 during the third revision of the case, quashed Thorbeck's and Huppenkothen's sentences, and acquitted them of the charges of being accessories to murder by their participation in the drumhead trial on grounds that the court had been duly constituted and the sentence had been imposed according to the law then in force, without either of the accused having perverted justice. On the centenary of Dohnányi's birth in 2002, Günter Hirsch, president of the BGH, called those who had sentenced Dohnányi to death "criminals calling themselves judges". Hirsch said the 1956 ruling was shameful because as a result, not a single one of the Nazi-era judges who sentenced 50,000 Nazi opponents to their deaths were themselves found guilty after the war. On 23 October 2003, Israel honoured Dohnányi by recognizing him as one of the Righteous Among the Nations for saving the Arnold and Fliess families, at risk to his own life. His name has been inscribed in the walls at the Holocaust remembrance centre Yad Vashem in Jerusalem. His grandson Justus starred as Wilhelm Burgdorf in the 2004 film, Downfall.