In German Nazi regime (Socialist Germany), the Gestapo had authority granted by the state to investigate treason, espionage and sabotage cases as well as criminal attacks against the Nazi Party and Germany.
The word "Gestapo" is an acronym for Geheim Staatspolizei, meaning "Secret National Police", in English. It was administered by the Reichsssichertheitshauptamt (RSHA) Or the Reich's Main Security Office which operated in much the same way as the US Department of Homeland Security. In the case of Nazi Germany, the RSHA oversaw the Sicherheitsdienst or security service and the Sicherheitspoliezei (SIPO) or security police.
Under the law, the Gestapo was specifically exempted from responsibility to courts where citizens could normally sue the government for redress. Under German law, the Gestapo used the concept of Schutshaft, or "protective custody", a euphamism for the power to imprison people with out judicial proceedings. Under the law, the prisoner was required to sign his/her own Schutzhaftbefehl, order for protection. Protection from what might be the right question to ask - but they signed by hook or by crook.
I'd like you to scroll down to the bottom of the page on this blog at this point and look at the video on "Prolonged Detention". If you've watched the video before, humor me. Watch it again.