Which law defines self-defense

Section 6 - German Civil Code (BGB)

Book 1 general part

Section 6 Exercise of Rights, Self-Defense, Self-Help

Section 226 Ban on chicane

The exercise of a right is inadmissible if its only purpose is to cause harm to another.

Section 227 Self-Defense

(1) An act required by self-defense is not unlawful.

(2) Self-defense is the defense that is required to avert a current unlawful attack on oneself or on another.

Section 228 State of Emergency

1Whoever damages or destroys a third-party item in order to avert an imminent danger to himself or to another does not act unlawfully if the damage or destruction is necessary to avert the danger and the damage is not disproportionate to the danger. 2If the agent is responsible for the risk, he is obliged to pay damages.

Section 229 self-help

Anyone who takes away, destroys or damages an item for the purpose of self-help or who arrests an obliged person who is suspected of fleeing for the purpose of self-help or who removes the obligation of the person obliged to an act that he is obliged to tolerate does not act unlawfully, if official help cannot be obtained in time and without immediate intervention there is a risk that the realization of the claim will be thwarted or made significantly more difficult.

Section 230 Limits to Self-Help

(1) Self-help may not go further than is necessary to avert the danger.

(2) In the event of the removal of objects, an application for arrest in rem must be applied for, unless enforcement is obtained.

(3) In the event of the arrest of the obligated person, if he is not released again, personal security arrest must be applied for at the district court in whose district the arrest took place; the obliged entity must be brought before the court immediately.

(4) If the application for arrest is delayed or rejected, the items taken away must be returned and the detainee released without delay.

Section 231 Erroneous self-help

Anyone who undertakes one of the actions referred to in ยง 229 on the erroneous assumption that the prerequisites necessary for the exclusion of unlawfulness are present is obliged to pay damages to the other party, even if the error is not due to negligence.

Link to this site: https://www.buzer.de/gesetz/6597/b17827.htm