Xerox says it's killing its multibillion-dollar deal to be taken over by Japan's Fujifilm.

The iconic US printer and copier company announced the move in a statement late Sunday, saying it had reached a new agreement with activist investors Carl Icahn and Darwin Deason, who had bitterly opposed the Fujifilm deal.

The Japanese company said it disputes Xerox's "unilateral decision" and doesn't think the US company has the legal right to ax the deal.

Under the plan that Xerox (XRX) and Fujifilm (FUJIF) announced in January, the US company's operations would be merged with those of Fuji Xerox, a joint venture between the two firms. The deal would leave Fujifilm holding 50.1% of Fuji Xerox, with Xerox shareholders owning the rest.

But Icahn and Deason blasted the deal, saying it significantly undervalued the US company and would be its "death knell." With a combined 15% stake in Xerox, they launched an aggressive campaign to halt the merger and oust top managers, including CEO Jeff Jacobson.

Related: Xerox board does shock U-turn on deal with activist investors

They appeared to have gotten what they wanted earlier this month, striking an agreement with the Xerox board to replace Jacobson and six other directors with their own representatives --- and to move quickly to terminate or renegotiate the Fujifilm deal.

That plan fell apart days later amid recriminations from both sides, but now the Xerox board and the activist investors have settled their differences again. Under the agreement announced Sunday, Jacobson and five other directors have already stepped down, with the activist shareholders' picks replacing them, Xerox said.

Helping Icahn and Deason's case was a court decision in late April that temporarily blocked the planned merger with Fujifilm.

The Xerox board said it repeatedly asked Fujifilm in recent weeks to start new talks about improving the terms of the takeover but the Japanese company "provided no assurance that it will do so within an acceptable timeframe."

Related: Carl Icahn: Don't let Fujifilm 'steal' Xerox

As a result, it said it felt it was "in the best interests of the company and all of its shareholders" to scrap the Fujifilm deal and side with Icahn and Deason.

Fujifilm said in a statement that it's reviewing all its options, including legal action.

It said it still believes the takeover is "the best option designed to allow the stockholders of both companies to share the enhanced future value of the combined company."