“Some sort of deal was hashed out for the majority of the 20 to vote for McCarthy for speaker, but this deal was crafted in private, behind closed doors,” Representative Nancy Mace, Republican of South Carolina wrote in a letter to her constituents on Monday. “We can’t think of anything more ‘swampy’ than a member of Congress who tells the American people they’re holding up the speaker vote because they’re ‘fighting’ the ‘swamp’ only to broker some back-room deal, hidden away from the American people.”

Still, Ms. Mace, who had initially signaled she might oppose the rules package because she and other rank-and-file lawmakers had yet to be briefed on the full extent of Mr. McCarthy’s concessions, supported the legislation after all.

Democrats opposed the rules but said they were even more worried about what else the speaker had agreed to in exchange for crucial support.

“What I’m not concerned about is not just what’s written down here,” Representative Jim McGovern of Massachusetts, the top Democrat on the Rules Committee, said as he gestured at the rules package. “I’m concerned by the back-room deals that Speaker McCarthy made with the Freedom Caucus in exchange for their votes.”

The Democrats were joined by one Republican. Representative Tony Gonzales, Republican of Texas, opposed the legislation, citing concerns that Mr. McCarthy’s agreement with the rebels on spending changes would lead to a significant cut to the nation’s defense budget. That prospect was a “horrible idea,” he said.

“I’m going to visit Taiwan here in a couple of weeks,” he said on CBS. “How am I going to look at our allies in the eye and say, ‘I need you to increase your defense budget,’ but yet America is going to decrease ours?”

But Mr. McCarthy’s team successfully kept defections to a minimum. It was a preview of the task the speaker faces as he works to appease the far right while maintaining the backing of a much larger group of more mainstream conservatives to pass any legislation on the House floor, where he can afford less than a handful of defections.