WASHINGTON — Republicans spent plenty of time over the past election year warning their voters that House Democratic Leader Nancy Pelosi would return to the national stage as House speaker if they didn't stop her party from taking control of Congress. Some Democratic candidates running in highly competitive districts even pledged not to support her. And at times over the past year, her own colleagues have agitated against her return to power.

Despite all that, Pelosi, the longtime California congresswoman who made history in 2007 by becoming the first woman to hold the House gavel, is poised to become speaker again after a midterm election that swept Democrats back into the majority.

Pelosi has been speaking privately with members, including those just elected, attempting to shore up her support and making the case that she is the best person to move the party forward. Some supporters say her experience is needed to maneuver a party that must confront President Donald Trump and an enhanced Republican Senate majority.

While she there is a cohort in the party who doesn't want her to take the reins, no other Democrat has emerged as a credible threat to Pelosi's leadership.

When asked by reporters on Wednesday whether she is confident of being elected Speaker, Pelosi said, "yes I am."

“I don't think anyone deserves anything. It's not about what you have done, it's about what you can do,” she said. “What you have done in the past speaks to your credentials,” she added, “and I think I'm the best person to go forward to unify, to negotiate.”

“I think my case is about being the best person for how we go forward.”

Rep. Seth Moulton, D-Mass., who has been one of her most vocal critics, doesn't want to run for the position, according to his spokesman Matt Corridoni. And Rep. Tim Ryan, D-Ohio, who ran against Pelosi in the last Congress, getting 63 votes compared to Pelosi's 134, has not stepped forward to launch another challenge.

But her detractors say her path is narrow. She needs a majority of voting members, both Republican and Democrat, on the House floor to vote for her. If all Republicans vote against her, she can only afford to lose about a dozen Democrats, depending on how many seats Democrats end up winning after all the races are totaled.

Rep. Steny Hoyer of Maryland, the No. 2 House Democrat, is expected to remain in his position, too. "I'll certainly be running for majority leader," not speaker, Hoyer told reporters, officially announcing his intention on Wednesday. The party's third-ranking member, Rep. Jim Clyburn of South Carolina, plans to run for that spot again, telling reporters that he is sending a letter on Wednesday to his colleagues asking for their support.

Pelosi, Hoyer and Clyburn all say that they will be transitional figures, preparing the next generation of leaders. Whether that means Pelosi will pledge to serve just one term is unclear.

Democrats' dissatisfaction with Pelosi reached a boiling point in the last Congress when a new generation of members, many of whom had only served in the minority, grew frustrated with a lack of upward mobility and a leadership structure where the top two members — Pelosi and Hoyer — had served in those positions since 2002.

Shortly after the House outcome became clear on Tuesday, Pelosi was asked what her message is to newly elected Democrats who said they wouldn't vote for her as speaker. "Congratulations on winning," she said.

Pelosi got a boost of support from an unlikely source on Wednesday — President Trump, who said, perhaps because she's an easy target for Republicans, the Democrat deserved the speakership. "In all fairness," Trump Tweeted, "Nancy Pelosi deserves to be chosen Speaker of the House by the Democrats. If they give her a hard time, perhaps we will add some Republican votes. She has earned this great honor!"

In all fairness, Nancy Pelosi deserves to be chosen Speaker of the House by the Democrats. If they give her a hard time, perhaps we will add some Republican votes. She has earned this great honor! — Donald J. Trump (@realDonaldTrump) November 7, 2018

Republicans, who will be in the minority come January, are facing a leadership shuffle, too.

Speaker Paul Ryan of Wisconsin is retiring, and his second in command, Rep. Kevin McCarthy of California, is running for minority leader. But one of the most conservative members of the House, Rep. Jim Jordan, R-Ohio, who is an aggressive defender of the president, has launched his bid for leader as well. And there's already jockeying for other GOP leadership posts. Rep. Liz Cheney of Wyoming announced her intention to run for House GOP conference chair.

But while Pelosi's path back to power appears clear, House Democrats face a challenging atmosphere for the next two years.

For the first time in his presidency, Trump will be forced to deal with congressional Democrats who now have the power to stop his agenda, promote their own and launch a myriad of investigations into his administration.

An increased Senate majority and the president's veto pen will all but ensure that Democratic legislative priorities go unfulfilled. And both parties will almost certainly busy themselves gearing up for the presidential election in 2020.

While there is historical precedent for divided government to reach common ground and address national problems, the current political environment makes the prospects unlikely, some members say.

“I think it’s going to be very tough to govern over the next two years,” retiring Rep. Ryan Costello, R-Pa., told NBC News.

Democrats believe the midterm elections were a referendum on Trump and Republican policies, a repudiation of GOP effort to repeal the Affordable Care Act, construct a $25 billion border wall and push additional tax cuts for the wealthy.

There's little incentive to work together on legislation. The president’s overt appeals to his base, while making him hugely popular among Republicans, has made him deeply unpopular among Democrats and many independents.

And Democratic activists are demanding that their congressional leaders do what they can to stop the president in his tracks.

“The most immediate priority has to be real oversight and accountability that has been shockingly absent over the last two years,” said Ben Wikler, executive director of the progressive group MoveOn.

David McIntosh, a former member of Congress and current head of the conservative Club for Growth, said such activists are "so angry that I don’t see opportunities to work together."

Pelosi would be in charge of the most diverse caucus in history with a record number of women being elected to the House on Tuesday, including the first two Native American women and the first Muslim woman.

The number of members who represent districts that supported the presidential candidate of the opposite party has also dwindled in the 2018 midterms.

But the Congressional Progressive Caucus is likely to have more weight as it is likely to increase its ranks from 78 members, which will pressure Democratic leadership to enact more of its agenda.

Shaunna Thomas, executive director of UltraViolet, a progressive feminist activist group, said that the group’s members will immediately put pressure on elected officials.

“We really get to work the day after the election to ensure that the people who now have the power will be held accountable to an agenda that will ensure that they are serving their constituents in a way that they deserved to be heard,” Thomas said.