Aside from the mandatory negotiation with the employee co-determination (works council), the layoffs "must be determined according to the principles of social selection [...] (t)his is often perceived as a major obstacle [...] it would be disastrous to have to dismiss top performers simply because they are younger than other employees or have been recently hired."
[Source] Random link from the Internet so that I don't need to translate: https://www.emplawyers-muenchen.de/wp-content/uploads/files/...