HR department: employees' ally or enemy?

In an ideal world, employees should regard the HR department as their ally who takes care not only of administration connected to legal aspects of the employer-employee relationship, but also tends to the well-being of employees and fights with company management on their behalf. In reality, however, the reputation of HR departments is less positive. According to a survey by the TeamBlind project, up to 70% of employees do not trust their HR department, considering them rather as an adversary protecting the interests of the employer. So how is it? Is the HR department an ally or an enemy of employees?