Giving up execution: voluntariness is the decisive point.
Whoever voluntarily gives up the execution before the offence is completed can remain unpunished under section 16 StGB. Voluntariness is decisive. If the execution is broken off only because an external obstacle makes it impossible or too risky, voluntariness is missing and withdrawal is excluded.
From a legal perspective the precise account of the motives is important. A voluntary giving up exists if the defendant on their own decision no longer wants to carry out the offence although they could still complete it.