Armed with a battalion of lawyers, warring factions of the family-owned Market Basket grocery stores announced a truce Thursday in their fight for control of the chain, with minority shareholders agreeing to buy out majority shareholders.

The deal was marked by plenty of economic, political and family intrigue surrounding two arms of the owning family: the majority shareholders headed up by Arthur S. Demoulas and the minority shareholders led by Arthur T. Demoulas. Arthur S.’s faction ousted Arthur T. from his role as CEO after gaining control of the company’s board earlier this summer, but Arthur T.—known affectionately as “Artie T” to employees and customers—resumed his role as CEO immediately as part of Thursday’s deal.