The two sides in Market Basket's epic grocery battle have finally reached a deal. And in a historic turn of events, it's the employees who won.

"I am in awe of what you have all accomplished," reinstated Market Basket leader Arthur T. Demoulas said to a cheering crowd of workers on Thursday. "It's great to be back together again." Employees had been protesting for six weeks to bring back Demoulas, their beloved former president, after he was ousted in June by the company's board.

The rallies were extraordinary for how many management-level and front-line workers came together to protest, for how many customers and even suppliers joined in their fight, for how two governors got involved in the resolution, and — most of all — for how the workers ultimately changed the course of a multi-billion dollar company with 71 stores in three states.

"This was an unprecedented protest, but the fact that they have been successful is historic," says Daniel Korschun, a marketing professor and fellow at Drexel University's Center for Corporate Reputation who is writing a case study about Market Basket. "They have really defied what the textbooks say is possible. This is the only time to my knowledge that employees, customers and suppliers have ever joined together and successfully challenged a board of directors."

Just before midnight on Wednesday, the New England company's shareholders announced they had entered into an agreement for Demoulas and his relatives to purchase the 50.5 percent of shares that had been held by a rival faction of the family. Demoulas (known as "Arthur T.") had been fired essentially by his cousin, who previously controlled the board of directors. Employees rallied on Arthur T.'s behalf this summer in one of the business world's most remarkable and unusual labor battles. They launched huge protests for his return and walked off the job, convincing customers and even suppliers to join their fight, which resulted in empty store shelves, millions in losses and lost hours for many employees.

Arthur T. will return with "day-to-day operational authority" of the company "effective immediately," the statement from shareholders said. He will work with the current co-CEOs, who will remain in place until the deal closes, which could take several months.

The agreement came after several days of scheduled-then-cancelled board meetings. Reports say financing from an unidentified private equity firm helped clinch the deal. In a statement from the board, directors were also careful to note the involvement of Massachusetts and New Hampshire Governors Deval Patrick and Maggie Hassan. "The Commonwealth of Massachusetts and the State of New Hampshire should understand that the governors' commitment and engagement made a significant difference," the statement read.

While the issue had become a political hot button in New England, with everyone from gubernatorial candidates to state senators weighing in on the debate, some observers say the involvement from state officials was more than political. "This had started to become a social welfare issue as well," Korschun says. "If the company had gone into bankruptcy or become insolvent, it would have had terrible implications for the whole region."

In addition to the jobs lost — both at Market Basket and at the company's vendors and suppliers — it also would have continued to affect low-income customers, who relied on the company's comparably lower prices for groceries.

The employees calling for the return of Arthur T. began their protests out of concern that the board and new outside co-CEOs would make changes to the company's culture and business model. The former chief was known for paying above-average compensation and benefits, but also for his generosity and accessibility, showing up at employees' family weddings and funerals.

Over the course of the protests, Arthur T. was celebrated with campaign-like signs saying "I Believe." One district manager at the company, who had been fired, compared him to the "It's a Wonderful Life" character George Bailey. "He cares more about people than he does about money," Tom Trainor, a 41-year veteran of the company, told On Leadership in July.

That leadership philosophy will be put to the test as the returning buyer has to rebuild the company and dig it out from weeks of losses. Suppliers and customers could be wary of returning from all the drama. But Korschun doesn't think that will be an issue. "This is such a cohesive group and they’re so committed to these stores," he said. "If I had to predict, I think there will be some real heroic efforts over the next few weeks."

Read also:

Like On Leadership? Follow us on Facebook and Twitter.