To understand what went on here you would need to have the full facts, and that isn't going to happen. On the face of it an officer was subjected to a sustained period of racist and homophobic abuse,and I'm not surprised to hear that he suffered from depression as a result.
Police work of the kind this officer was doing involves daily contact with a tight-knit group of colleagues,and anyone who is 'different' is likely to come in for some robust treatment. It's regrettable, but it happens, and I think it extremely unlikely that Police services will ever be totally rid of such attitudes.
That senior officers should have apparently taken part in the harassment is a disgrace.