The role of the Gestapo was to investigate and combat "all tendencies dangerous to the State." They had the authority to investigations treason, espionage, and sabotage cases, and cases of criminal attacks on the Party and State.
The Gestapo's actions were not restricted by the law or subject to judicial review. The Nazi jurist, Dr. [Werner Best]?, stated "As long as the [Gestapo]... carries out the will of the leadership, it is acting legally."
The power of the Gestapo most open to misuse was Schutzhaft - the power to imprison people without judicial proceedings on the basis of "protective custody."