The U.S. and Brazil have settled a long-standing trade dispute regarding subsidies that Washington provided to American cotton growers, Associated Press, or AP, reported, citing a source. The dispute has colored relationships between the two countries since 2002.

The official said, according to AP, that though the deal has not been officially announced by the two countries, the new agreement, which is to be signed Wednesday, is expected to allow Washington to fully implement the farm bill, which was approved by Congress in February. The new agreement also includes a new insurance program for cotton growers, which was put in place to adhere to new rules of the World Trade Organization, or WTO. Brazil will also not challenge the support promised to American cotton farmers by the farm bill, AP reported.

In 2002, Brazil had filed a complaint in the WTO against the U.S. stating that the trade subsidies the American government provided its cotton growers were disrupting trade and was a violation of global trade rules, according to Bloomberg. Brazil won the case and the WTO allowed Brazil to seek $830 million in penalties from the U.S., which instead agreed to pay Brazil’s cotton industry $147 million in annual aid. According to AP, the U.S. agreed to make a final one-time payment of $300 million to the Brazil Cotton Institute.

When the annual aid was stopped in October 2013, to pave way for federal budget cuts, Brazil threatened higher tariffs on American products. However, the new farm bill includes modified cotton programs to help assuage Brazil’s concerns, Bloomberg reported.

Relations between Brazil and the U.S. were further strained after revelations made by whistleblower Edward Snowden showed that the National Security Agency had spied on Brazilian President Dilma Rousseff. Rousseff had demanded an apology from the U.S., which said that it regretted the incident but did not issue a formal apology, according to Reuters.

The deal, to be signed Wednesday by Agriculture Secretary Tom Vilsack and U.S. Trade Representative Michael Froman, and their Brazilian counterparts, according to AP, comes just days ahead of elections in Brazil.