After GOP leadership capitulated to conservative demands, the House narrowly passed legislation Thursday to cut food stamp spending by nearly $40 billion over 10 years.

The bill passed 217 to 210. Fifteen Republicans joined 195 Democrats in voting against the bill. Six members did not vote; 217 votes were the threshold for passing the measure.

The bill will now likely be merged with the rest of the farm bill passed by the House in July in conference with the Senate. The Senate-passed farm bill cut food stamp spending by a far smaller amount, $4 billion over 10 years, so the program’s funding could be a sticking point between the two chambers.Senate Democratic aides previously told TPM that their caucus wouldn’t agree to cuts anywhere near what the House has passed.

“House Republicans have turned their backs on American families struggling to put food on the table. It’s true the bill being considered in the House of Representatives today would save $40 billion. But how would it save that $40 billion?” Senate Majority Leader Harry Reid said Thursday on the Senate floor. “By snatching food out of the hands of millions of the neediest children and their families. House Republicans are determined to gut the nutrition assistance program, although 9 out of 10 recipients are families with children, senior citizens or people with disabilities.”

The vote is a victory for House Republican leadership after food stamps were the source of an embarrassing episode during the June farm bill vote. Majority Leader Eric Cantor was forced to pull the bill, which had $20 billion in food stamp cuts, from the floor because it didn’t have enough support from conservatives, who wanted deeper cuts. The House then passed in July a farm bill without any food stamp provisions.

So Cantor came back this month with a cut twice as deep, and it squeaked through the chamber Thursday. The Congressional Budget Office estimated that up to 3.8 million people would lose benefits under the law.

Leadership still lost a number of conservatives, as TPM reported they likely would. But they held enough of the caucus this time to pass the cuts.

Speaker John Boehner told reporters Thursday that he would appoint conferees for the farm bill package “as soon as possible.” He had declined to do so before the House passed a food stamp bill.

The 2008 farm bill, which was extended as part of the January fiscal cliff deal after the parties failed to reach a compromise on reauthorization last year, expires on Sept. 30.