WASHINGTON — House and Senate negotiators agreed Monday on a new five-year farm bill that would eliminate or consolidate dozens of agriculture subsidy programs, expand government-subsidized crop insurance and cut about $9 billion from the food stamp program over the next decade.

The bipartisan agreement, two years after lawmakers began work on the nearly $1 trillion bill, is a major step forward in reauthorizing hundreds of farm and nutrition programs that must be renewed every five years. And, at least for now, it brings an end to the partisan fighting that stalled two previous attempts to pass the legislation. The bill would reduce spending by about $23 billion over the next 10 years.

The House is expected vote on the measure on Wednesday. It is unclear when the Senate will take up the legislation. Many Senate Democrats are likely to be unhappy with the food stamps measure, which is more than double the $4 billion in cuts that senators approved in May.

Yet the food stamp cuts may not be large enough to appease House conservatives, who in June helped defeat a bill backed by Speaker John A. Boehner that would have cut $20 billion from the program. The House eventually passed a bill covering nutrition programs only that would have sliced nearly $40 billion from food stamps.

The negotiations were led by the leaders of the House and Senate Agriculture Committees, Rep. Frank D. Lucas, R-Okla., and Sen. Debbie Stabenow, D-Mich.

The deal “puts us on the verge of enacting a five-year farm bill that saves taxpayers billions, eliminates unnecessary subsidies, creates a more effective farm safety net, and helps farmers and businesses create jobs,” Stabenow said.

Farmers also welcomed the news of the agreement.

“The bill is a compromise,” said Ray Gaesser, an Iowa farmer who is president of the American Soybean Association. “It ensures the continued success of American agriculture, and we encourage both the House and the Senate to pass it quickly.”

Anti-hunger advocates criticized the agreement.

“They are gutting a program to provide food for hungry people to pay for corporate welfare,” said Joel Berg, executive director of the New York City Coalition Against Hunger.

The new bill would make the most significant changes to farm programs in decades. It would avoid some of the drastic measures that were part of the House bill, like work requirements and drug testing for food stamp recipients, but anti-hunger advocates said the $9 billion cut would reduce benefits by about $90 a month for 850,000 households.