A farmer harvests his field at his farm in Pecatonica, Illinois, U.S., July 25, 2018. Photo taken July 25, 2018. REUTERS/Joshua Lott

WASHINGTON (Reuters) - U.S. lawmakers have struck a deal in principle on the Farm Bill, the top agriculture lawmakers and senators said on Thursday, capping months of bitter partisan debate over the legislation to fund $867 billion in food and agriculture programs.

“We are pleased to announce that we’ve reached an agreement in principle on the 2018 Farm Bill,” a joint statement from the chairmen and ranking members of Senate and House Agriculture Committees said.

“We are working to finalize legal and report language as well as CBO scores, but we still have more work to do. We are committed to delivering a new farm bill to America as quickly as possible,” they said in a statement.

Programs covered by the bill include crop subsidies and support to access export markets, areas essential for American farmers, a key constituency of U.S. President Donald Trump.

Such funding is crucial as farmers suffer from Trump’s trade wars with key commercial partners such as China, normally the top buyer of U.S. farm produce but which has been absent from the market after the imposition of tariffs.

The latest bill, passed in 2014, expired on Sept. 30 after talks over its replacement broke down. At the heart of the debate was whether or not to impose stricter work requirements for recipients of food stamps.

Recently, the main standoff had focused on forestry provisions following the deadly wildfires in California.

The agreement is yet to be integrated into the text of the legislation and lawmakers will have to decide whether it will be voted on as a standalone bill or within a bigger package. Once voted on, the bill goes to the president for final signature.

The lawmakers have until the end of the year to finalize the process.