WASHINGTON — House Minority Leader Nancy Pelosi on Wednesday won the race to lead the Democratic caucus for an eighth term, prevailing in a contest that became a vote of confidence in her continued stewardship and an early proxy battle over the future of the Democratic Party.

The Californian easily toppled Rep. Tim Ryan, D-Ohio, a seven-term lawmaker who launched an upstart bid to lead House Democrats two weeks ago in response to the party’s disappointing November election results.

After 14 undistinguished years in Congress, Ryan emerged from the backbench — he literally sits in the last bench in the chamber — as a vessel of discontent and forced Pelosi to fight for the top spot like never before. It’s prompted her to offer structural changes to leadership and more opportunity to the burgeoning crop of junior lawmakers who have never served in the majority.

Pelosi vowed to expand the number of seats at the leadership table to stave off defections and leave her firmly in charge of a caucus ruled by an “iron fist,” as Senate counterpart, Minority Leader Harry Reid, D-Nevada, once described her leadership style.

There are 194 members of the House Democratic caucus, and four nonvoting delegates are allowed to vote in caucus elections. On Wednesday, 197 of the 198 members showed up. Pelosi won with 134 votes, compared to 63 votes for Ryan in a secret-ballot election held in the august committee room of the House Ways and Means Committee.

“We got the message out that we wanted to get out. … We’re going to win as Democrats if we have an economic message that resonates in every part of the country,” Ryan told reporters after his defeat.

“We disappointed because I like to win. … But the party is better off,” he added.

Ryan was flanked by some of his closest supporters, Reps. Sean Moulton, D-Massachusetts, Marcia Fudge, D-Ohio, Stephen Lynch, D-Massachusetts, Ed Perlmutter, D-Colorado, Ruben Gallego, D-Arizona, and Dan Lipinski, D-Illinois.

Another Ryan supporter, Rep. Kyrsten Sinema, D-Arizona, said she was “disappointed” that House Democrats “decided to double down on its failed strategy of recent years.”

“This should be a time of critical reflection and clear-eyed change, not a time to rubber stamp the failed strategy of the past,” she said in a statement.

Pelosi was expected to address reporters later on Wednesday.

She had set the expectations bar high by publicly declaring she has “more than two-thirds” of the votes locked up. She cleared that threshold on Wednesday, but Ryan’s 63 votes was the highest margin of rejection Pelosi has ever faced.

His supporters believed that the closer Ryan got to between 60 and 80 votes, the more direct the signal to Pelosi that the rank-and-file is ready for her to develop a transition-of-power plan. At 76, she’s one of three septuagenarians leading the caucus, followed by 77-year-old Rep. Steny Hoyer, D-Maryland, the minority whip; and 76-year-old Rep. James Clyburn, D-South Carolina, the assistant to the leader.

Hoyer and Clyburn were unchallenged Wednesday and are expected to be easily re-elected.

In the days before the vote, Ryan railed against Pelosi and Hillary Clinton’s presidential campaign for failing to connect with voters in economically distressed parts of the country.

Pelosi tried to placate some of the angst among junior lawmakers by offering a series of new or modified positions, including the new position of “vice-ranking member” on the more than 20 standing House committees and reserving it for lawmakers who served four terms or less. A policy leadership position would be divided into three co-chairmen and reserved for those who have served five terms or less.

Rep. Beto O’Rourke, D-Texas, credited Ryan’s challenge with forcing Pelosi to take the unrest among colleagues more seriously.

“That’s partly a response to the competition in the caucus for votes, and that’s a healthy thing,” he said.

Others remain upset at Pelosi’s control of the House campaign arm, the Democratic Congressional Campaign Committee. She has proposed leaving Rep. Ben Ray Lujan, D-New Mexico, as DCCC chairman for another term, despite 2016 elections that saw just a six-seat gain after Pelosi personally predicted a gain of more than 20 seats.

“We should have been recruiting earlier, we should have better targeting. I think our messaging was off,” Gallego said in an interview on Tuesday. “I think we are focused so much still on TV instead of looking at new methods of communications and/or even old methods of communication — canvassing and digital buys.”

A 37-year old former Marine corporal, Gallego was especially critical of what he considered the DCCC’s staff work trying to please Pelosi, calling them “bureaucratic in nature.”

Some Democrats want the position to be contested rather than rubber stamp of whoever top Democrats select.

Pelosi’s backers reminded detractors that House Democrats are now in a “comeback situation” without a Democratic president in office — a dynamic similar to 2000 when Bush took office after a fiercely partisan, closely contested election. Over six years, Pelosi served as Bush’s main partisan foil and ultimately led a campaign that regained House control.

Supporters also acknowledged, however, that after 14 years atop the party, Pelosi is nearing her political twilight.

“This is probably her last go,” said one member who requested anonymity to speak frankly about caucus dynamics. “She’s coming to terms with the idea that people want her to move on. The opposition is so public now and I only see that growing, not diminishing.”

The prospect of Pelosi’s departure and the likely demise of Hoyer and Clyburn, would create an incredible leadership vacuum.

But in a few years, “I don’t see an 80-year old new minority leader,” the member said.

The Washington Post’s Mike DeBonis contributed to this report.