LEESBURG, Va. — House Democrats this week headed to a retreat in suburban D.C. to celebrate “100 days of achievement” after reclaiming the majority in January and passing a bevy of policy bills.

But by the time they arrived in Leesburg, Va., they had suffered a bruising internal fight over spending that forced Speaker Nancy Pelosi to cancel a vote on a critical bill to raise mandatory spending caps for the next two fiscal years.

Democrats hoped a strong party vote in favor of their plan to provide generous increases for domestic spending would give them more leverage as Pelosi heads into bipartisan talks on a final caps deal with President Trump and Senate Majority Leader Mitch McConnell, R-Ky.

But their progressive wing wanted a higher amount of domestic spending and less for the military budget and refused to back the deal, while fiscally moderate Democrats complained the price tag was too high.

The fight left the caucus short of the votes needed to pass the measure and sent a powerful message to the party that the unity they had enjoyed in the minority has its limits now that they run the House and are responsible for leading the way on must-pass spending measures.

“We’ve got a lot of members on a learning curve, a steep learning curve,” House Budget Committee Chairman John Yarmuth, D-Ky., said.

Democrats are now dealing with the same problems Republicans confronted while in the majority: Winning elections brings more diversity to the caucus, making it harder for everyone to agree.

Yarmuth met with moderates groups and progressives over recent weeks “trying to find what was doable, what was the sweet spot was.”

Yarmuth wrote a measure he felt convinced “had the best possible chance” of winning a majority without Republicans, who generally never back Democratic budget measures.

He introduced a measure that would have lifted the current domestic spending limit by 5.7%, to $631 billion in fiscal 2020, and to $646 billion in fiscal 2021. The measure would have raised defense spending by 2.6% over the current cap, to $664 billion, in 2020. Defense spending would be capped at $680 billion in fiscal 2021.

But Progressive Caucus Co-Chair Pramila Jayapal, D-Calif., called for a $33 billion domestic spending increase over Yarmuth’s cap, and a reduction in military spending.

Moderate Democrats, meanwhile, fretted over the impact of increasing spending on the nation’s ballooning debt and deficit.

“We're OK with increasing the spending levels as long as its paid for,” said Rep. Kurt Schrader, D-Oregon, who is a member of the moderate Blue Dog coalition.

House Democrats ultimately punted the budget caps deal to the top bipartisan leadership in the House and Senate, who plan to work out a deal with President Trump.

Pelosi and other Democratic leaders downplayed the failed budget vote and pointed to the many policy measures Democrats easily passed since reclaiming the gavel in January.

“It serves your purpose to say we are seething,” Pelosi told reporters. “But we are right on track to serve the American people.”

House Democrats have passed plenty of landmark legislation this year, including a gun control measure and a bill to reform the nation’s campaign finance and voting laws.

Next month, they’ll pass measures to legalize Dreamers, tackle climate change and institute regulations to ensure pay equity for women.

None of these big policy priorities has a chance of coming up in the GOP-led Senate, but that doesn’t matter, Pelosi said. The measures are popular with voters.

“The reason we are optimistic and hopeful is not that we can pass bills in the House,” Pelosi told reporters. “We intend to do that, to state our purpose, to honor our commitment to the American people, to make advances on their behalf.”

But Democrats will still have to grapple with must-pass spending legislation, which as the failed budget accord demonstrated, divides the caucus in the same way it splintered the GOP majority in the past decade. The fiscal year ends Sept. 30.

Yarmuth has struck up a close friendship with the top Republican on the budget panel, Rep. Steve Womack of Arkansas, who struggled with uniting the GOP around spending limits and is quite familiar with Yarmuth’s challenge.

“He is just laughing at me,” Yarmuth said. “He says, I feel you pain, I feel your pain. I know exactly what you are going through.”