Aramark Corp. said Friday that it will pay $21 million to settle two proposed class-action lawsuits over the Philadelphia company’s cancellation of bonuses for thousands of managers in February.

The ensuing uproar among managers, some of whom lost 20% of their expected annual compensation, contributed to the abrupt departure of chief executive Eric Foss in August.

“We believe it is in the best interest of our employees and the company to put this matter behind us,” Aramark said in a statement.

The settlement comes about a month after John Zillmer, the new CEO, took over. The bonus denial and the events that followed contributed to low morale among employees, a problem Zillmer acknowledged in an interview last month.

The settlement, which requires court approval, is expected to benefit about 4,500 employees and former employees. The company employs about 274,400 people, including 14,000 in Pennsylvania and nearly 6,500 in the Philadelphia region. The $21 million includes fees for attorneys.

As part of the mediated settlement, the company, attorneys for the employees, and the employees named in two lawsuits filed in U.S. District Court for the Eastern District of Pennsylvania agreed not to discuss the case.

Foss came under fire when he decided not to pay bonuses earned in 2018 to front-line managers because the company did not meet a profit target set by the board of directors. Employees found it especially egregious as Foss — who earned $16 million in 2018, including $2.6 million in incentive bonus — touted record revenues and profitability for the year ended in September.

Managers were furious at Foss because they were not told at the beginning of the fiscal year that a company-wide profit target would be a factor in their bonuses.

Another significant change at Aramark is the presence of activist investor Paul C. Hilal as the company’s largest shareholder. Hilal notified the company in August that he planned to have “conversations, meetings, and other communications” with members of Aramark’s board, management team, and other stockholders “to discuss the issuer’s business, operations, strategies, governance, the composition of the executive suite and board, and possibilities for changes.”

Less than two weeks later, the company announced Foss’ retirement.

Hilal, whose Mantle Ridge LP has a claim on 20% of Aramark though stock holdings and other instruments, is now vice chairman.