WASHINGTON — House Democrats on Wednesday nominated Nancy Pelosi as speaker, paving the way for her to be elected to the top post in January.

Pelosi, who previously served as the first woman speaker from 2007 to 2011, prevailed in the closed-door Caucus vote as Democrats held their leadership elections for next year, despite a long-simmering insurgency against her bid — a rebellion that appeared to crumble in the days leading up to the vote.

"As I say, our diversity is our strength but our unity is our power. We will use that power again in a unifying way for our country," she told reporters.

The 78-year-old California Democrat had faced threats from all corners of her Caucus — from moderates, from progressives, from members-elect and from younger lawmakers hoping for a generational change. But leading up to Wednesday's vote, following lobbying from Pelosi herself, individuals from each of these factions who had either previously expressed opposition to her or signaled skepticism came out publicly in support.

Flanked by her supporters as they continued to count the votes for speaker, Pelosi told reporters, "I’ve always had an opposition. Today it didn’t materialize into an opponent."

Her supporters also took a victory lap. "This time she is the very best. She’s not just a candidate. She is the very best that we have to lead us through this cycle and to prepare us for transition," said Rep. Joyce Beatty, D-Ohio, who was among several lawmakers who seconded Pelosi's nomination, to reporters.

Despite the threat from rebellious lawmakers, Pelosi ran unopposed during the election in which lawmakers voted by secret ballot. She just needed a simple majority on Wednesday in order to win and wasn’t expected to have a problem crossing that threshold.

In early January, when the lower chamber holds the formal speaker vote on the floor, Pelosi will need a majority of the whole House present and voting. Any opposition to her bid on Wednesday may not weigh heavily in the end on whether she wins back the gavel next year. Sixty-three House Democrats in 2016 voted against Pelosi during the closed-door Caucus vote, for example, voting instead for Rep. Tim Ryan, D-Ohio, but only four members ultimately voted against her on the floor just a few weeks later.

Rep. Brian Higgins, D-N.Y., who initially signed a letter opposing Pelosi and later switched to support her, said Pelosi can “easily” get the extra votes she’ll need in January — but it might require her to cut more deals with recalcitrant members.

“This is raw politics,” Higgins said. "Over the next 30 days, the folks that are withholding their support will have leverage like they’ve never had before."

"There’s still a lot of game left to play,” he added. “I think members have all signaled a willingness to deal.”

Meanwhile, two newly elected Democrats, Max Rose from New York and Jeff Van Drew from New Jersey, said there was no way Pelosi could change their mind, though neither ruled out voting “present.”

“I made a promise to the voters of my district to be a no,” Rose said.

Republicans have villainized Pelosi over the last decade, spending millions of dollars on ads featuring her during the midterm campaigns. President Donald Trump frequently made Pelosi a target of attacks at campaign rallies, though he has also expressed respect for her. “We actually have a great relationship,” he said at a White House press conference one day after the elections. “I give her a great deal of credit for what she’s done and what she’s accomplished.”

For her part, Pelosi publicly dismissed the bubbling insurgency threat earlier this month and expressed confidence that she would prevail.

“It doesn’t matter to me whether they support me," she said at a press conference then. "What matters is that they support a Democratic agenda to make progress for America’s working families."

The unrest seemed to come to a head shortly before Thanksgiving, with Rep. Marcia Fudge, D-Ohio, former chair of the Congressional Black Caucus, weighing a challenge against her. Fudge, however, ultimately decided to back down — instead accepting a Pelosi offer to lead a voting rights panel.

Fudge added that Pelosi “assured me that the most loyal voting bloc in the Democratic party, Black women, will have a seat at the decision-making table” and pledged to support Pelosi for speaker.

Asked Wednesday if she would consider offering herself as an alternative in January if Pelosi doesn't secure enough votes on the floor, Fudge didn't rule it out.

"I haven’t thought about it, but I probably would give it some thought, but I haven’t given it much thought because I think she’s going to get them," she said.

Pelosi had also faced a threat to her leadership from other parts of the party. A number of members-elect had said during their midterm races that they wanted change in Washington and either said or signaled that they would oppose Pelosi for speaker.

Another faction within the Caucus — nine moderates who are members of the bipartisan Problem Solvers Caucus — had also suggested that they could oppose Pelosi if she doesn’t back three of their proposed rules changes that would weaken the power of party leaders by allowing bipartisan groups of lawmakers to move legislation directly to the House floor, circumventing the Speaker and committee chairmen.

Pelosi met with the group several times, including on Tuesday. Ahead of Wednesday afternoon's vote, nine Democratic members of the Problem Solvers Caucus announced that they had struck a deal with her on a number of proposed rules changes.

“These commonsense rules changes will allow for the will of the majority to turn ideas into action and pass much-needed legislation,” they said in a statement. “...We have reached such an agreement with Leader Pelosi to help Break the Gridlock for the American people and will support her, so these rules and reforms can be adopted in January.”

Some of the proposed rules agreed to would kick-start a process that would more easily bring bills with at least 290 co-sponsors to the floor. Others include a measure that would increase committee transparency and ensure that a majority of members of a committee can request and schedule a markup.

Pelosi had also been able to pick away at other parts of the rebellion.

Last week, progressive Rep.-elect Alexandria Ocasio-Cortez, D-N.Y., 29, who defeated Caucus Chairman Joe Crowley in their Democratic primary this year, announced that she would support Pelosi, tweeting, “All the challenges to Leader Pelosi are coming from her right, in an apparent effort to make the party even more conservative and bent toward corporate interests. Hard pass. So long as Leader Pelosi remains the most progressive candidate for Speaker, she can count on my support.”

Others remained unplacated.

Before the vote, several House Democrats opposed to Pelosi's bid met with her — including vocal critic Rep. Seth Moulton, D-Mass., who said in a statement that Pelosi would not have the 218 votes necessary to become speaker next year.

"Her three-person leadership team has been unchanged in 11 years. Our request was, and has always been, simple. Produce a meaningful plan for a leadership transition, as you promised in the summer, to allow a new generation of leadership to step forward," he said. "I am disappointed to report that no agreement was reached in this initial meeting. We are hopeful Leader Pelosi will invite us back to the table to plan for the future success of the Democratic Party."

Rep. Kathleen Rice, D-N.Y., who had also been opposed to Pelosi’s bid, said she had left her pre-vote conversation with Pelosi unsatisfied. "We remain united behind our goal of new leadership and intend to vote against Leader Pelosi in Caucus and on the Floor of the House," she said in a statement, telling reporters later that midterm voters "agitated for change, and if we don’t take that message and do the same thing here, shame on us."

The Caucus was also voting Wednesday for their next majority leader, majority whip, assistant Democratic leader, vice chair, Democratic Congressional Campaign Committee chair as well as the chair and co-chairs of the House Democratic Policy and Communications Committee.

Rep. Steny Hoyer, D-Md., the current minority whip, was elected to serve as majority leader, who determines the House floor schedule, while assistant Democratic leader James Clyburn of South Carolina was elected majority whip, and current DCCC chairman Rep. Ben Ray Lujan, D-N.M., was elected assistant Democratic leader. All were unopposed.

Hakeem Jeffries, D-N.Y, beat Rep. Barbara Lee, D-Calif., to serve as next chair of the House Democratic Caucus. Jeffries — like Lee, a member of the Congressional Black Caucus — has been eyed as a possible future Democratic leader, and the outcome of the election was viewed as a test of whether he would be able to climb the leadership ladder.