Dow Chemical ( DOW) and Rohm & Haas ( ROH) have reached an agreement to merge by April 1, according to a joint statement released late Monday.

Shares of Dow Chemical were falling nearly 6% at $5.97 in after-hours trading, while Rohm & Haas was gaining 4.5% at $77.44 a share.

The agreement came after a day of intense negotiation and two consecutive delays in the trial in which Rohm & Haas was suing Dow Chemical for breach of contract of their original merger agreement.

"Today's agreement resolves the litigation initiated by Rohm & Haas against Dow on January 26, 2009, with a resolution that is beneficial for each party," the joint statement said.

Aside from a key change in its financial structure, the merger between Dow and Rohm will go through according to the original deal points established last June.

Dow Chemical will pay most common shareholders of Rohm & Haas the prearranged price of $78 a share.

However, Rohm & Haas' two largest shareholders, the Haas Family Trust and Paulson & Co., a hedge fund, will contribute $2.5 billion in equity to Dow Chemical in exchange for preferred stock in Dow. They will also give Dow the option to accept an additional $500 million equity injection.

The additional equity will serve to reduce the amount of debt that Dow Chemical must incur in order to close the merger. The required debt load had ballooned to $13 billion at one point, although Dow Chemical succeeded in renegotiating the terms of the loan late last week.

Dow wanted to change the terms of the deal, arguing that economic conditions had made it unfeasible and after a Kuwaiti company backed out of a joint venture that would have helped with financing.

In a pretrial brief released as a response to Rohm & Haas' original complaint in the lawsuit, Dow Chemical had suggested that the amount of debt it would have to incur in order to finalize the merger would have put into question its viability as a going concern.

"The restructuring of the terms of the transaction allows Dow to maintain financial flexibility as we proceed to implement our strategy in a way that realizes the original promise of this acquisition," said Andrew Liveris, CEO of Dow Chemical.

More from Stocks

The Stock Market Has Every Reason to See a Fresh Rally

The Stock Market Has Every Reason to See a Fresh Rally

3 Simple Tips on Investing From TheStreet's Jim Cramer

3 Simple Tips on Investing From TheStreet's Jim Cramer

Video: There Are Some Big Changes Coming to the PGA Championships in 2019

Video: There Are Some Big Changes Coming to the PGA Championships in 2019

Tesla's Supercharger Network Is Booming -- Here's Why That's a Concern

Tesla's Supercharger Network Is Booming -- Here's Why That's a Concern

Attention 60 Minutes: Google Isn't the Only Big-Tech Monopoly

Attention 60 Minutes: Google Isn't the Only Big-Tech Monopoly