(Bloomberg) -- Activist investor Carl Icahn is ending a years-long investment in Xerox Holdings Corp. by selling his remaining stake back to the company for $542 million. 

Xerox agreed to repurchase all the shares held by Icahn and his affiliates for $15.84 apiece, the same as its last closing price in New York, according to a statement Thursday. Xerox will fund the transaction with a new debt facility. 

Jesse Lynn and Steven Miller, who work at Icahn-related firms, will step down from Xerox’s board at the closing of the deal along with Xerox Chairman James Nelson. Scott Letier, who has been on the board since 2018, will become the new chairman, according to the statement. 

The deal ends a years-long saga that included numerous lawsuits and several strategic moves. 

Icahn first disclosed a stake in Xerox in 2015, urging the company to explore strategic alternatives and improve operations while seeking board representation. Several months later, Xerox announced a split into two public companies, separating its service and hardware businesses. It also granted Icahn three board seats. 

In 2018, Icahn and another shareholder, Darwin Deason, protested a merger between Xerox with Fujifilm Holdings Corp., saying the deal undervalued the company. 

The investors also said management wasn’t qualified to run the company and called for the removal of Xerox’s then-Chief Executive Officer Jeff Jacobson. The pair sued Xerox, which resulted in the court temporarily blocking the deal before Xerox walked away and Jacobson resigned.

After Xerox walked away, Fujifilm said there was no legal ground for Xerox to terminate the transaction. It sued the company before ultimately striking a deal and agreeing to buy out Xerox’s stake their Asia Pacific joint venture for $2.3 billion in 2019. 

Icahn was also at one point a defendant in the saga. He was sued by an investor of Xerox in 2019, alleging that he bought HP Inc. shares knowing that Xerox was going to make a bid. 

Icahn, who urged Xerox and HP to put together a deal, reported a 4.24% stake that year before exiting in 2020. HP later rejected several offers from Xerox before a hostile tender offer was launched. Xerox withdrew its hostile bid in March of 2020 citing turmoil caused by coronavirus.

Moelis & Co. advised Xerox on the share repurchase from Icahn. 

(Update with background throughout)

©2023 Bloomberg L.P.