Market Basket's board of directors has signed a deal to sell the grocery chain to former CEO Arthur T. Demoulas for more than $1.5 billion, following months of massive employee protests and customer boycotts over his June ouster.

Market Basket and Arthur T. Demoulas confirmed just after 11 p.m. that shareholders had agreed to a deal to give Arthur T.'s faction a majority stake — 50.5 percent ownership — in the company. Sources had previously confirmed the deal to NECN's Josh Brogadir and Peter Howe.

"Effective immediately, Arthur T. Demoulas is returning to Market Basket with day-to-day operational authority of the company," the company and new owner said in a statement.

Employees and customers started a boycott earlier this summer after Demoulas' firing, leading to bare shelves and little business for the New England supermarket chain.

Current co-CEOs Felicia Thorton and Jim Gooch are staying in place pending the closing, which is expected to happen in the next several months. Arthur T. and his management team are returning during the interim period as the company's purchased is finished, the statement said. Arthur T. also said that all employees are welcome back to work to help "restore the Company back to normal operations."

Massachusetts Gov. Deval Patrick and New Hampshire Gov. Maggie Hassan said in a joint statement they are "delighted that the parties have reached agreement on terms of sale and resolution of operating authority, so that employees can return to work and customers once again will be able to rely on these stores to meet their needs."

Market Basket's board of directors fired Arthur T. and two other top executives on June 23. On July 15, executives at the company's headquarters in Tewksbury, Massachusetts, started calling for Arthur T.'s reinstatement. More than 2,000 employees rallied outside of Market Basket's headquarters on July 18, and the company fired eight employees who led the demonstration two days later. The rallies spread to the stores the next day, and continued at stores and headquarters for weeks.

The board of directors said in a statement late Wednesday that their shared goal now "is to return Market Basket to the supermarket that its customers have come to rely on for service, quality and best prices."

"We look forward to seeing you at your local Market Basket," the statement reads.