It’s official: Democrats have won back the House after eight years in the minority.

Democrats needed to gain 24 seats to flip control of the House; as of 11 pm, the party had enough projected wins to ensure they’ll control the chamber.

Related 4 winners and 2 losers from the 2018 midterm elections

Tuesday night’s win is a victory for the Democratic Party, regardless of the final breakdown of seats. Party enthusiasm was high in the Trump era, but gerrymandering gave Republicans a big structural advantage going into the midterms.

House Democrats will wield the speaker’s gavel once again, and with it, the power to investigate the Trump administration. They will also have more leverage on policy than they did in the minority.

The question of who will lead the Democrats could depend on the size of their victory. A narrow victory could make it more difficult for House Minority Leader Nancy Pelosi to become speaker of the House again. With some moderate Democrats pledging not to support her if elected, the math could be tight. But Pelosi knows the pressure points in her caucus — and how to count votes.

Now that she has shepherded her party to a win, Pelosi and her allies will likely make the case that they wouldn’t even have the majority if not for her. She logged record-breaking fundraising for House candidates in 2018, an important chip to help convince Democrats who might be on the fence to support her bid for House speaker.

The big question for whoever leads the party will be whether Democrats should attempt to do some bipartisan legislating, or will they use their new power to make Trump’s life hell?

For the first time in years, Democrats will have an opportunity to show the country their policy vision for the future. Ahead of 2020, the party’s left-leaning base badly wants leaders to chart a path that’s unabashedly progressive, including Medicare-for-all, a $15 minimum wage, and a green jobs bill.

But with such a slim majority, Democrats will have no choice but to work with Republicans to pass at least some bills through the chamber. There are plenty of things Democrats have identified that they can work with moderate Republicans on — namely, a large infrastructure bill.

“We’ve got to look at what’s doable,” Rep. Cheri Bustos (D-IL) told Vox in September. “Policies where we can win folks in the middle.”

Democrats have also proved they can negotiate with Republicans on large, bipartisan spending bills this year — there have been relatively few fights over spending in Congress. Beyond the task of negotiating with their colleagues across the aisle, Democrats will have to deal with an unstable entity: President Donald Trump. Trump has proved to be a difficult negotiating partner with his own party, and has been clear he plans to go head to head with Democrats after 2018.

Democrats now have the power to investigate

Democrats plan to investigate Trump and his administration top to bottom.

Democrats already have a list of more than 50 subpoena requests denied by the Republican majority that they plan to forge ahead with in January. They want to look into everything from Russia’s meddling in the 2016 election, to the administration’s response to Hurricane Maria, to Jared Kushner’s emails, to Trump’s attempts to destabilize the Affordable Care Act. Rep. Jerry Nadler (D-NY), who is likely to become the House Judiciary Committee chair, has promised an investigation into whether Supreme Court Justice Brett Kavanaugh perjured himself in testimony to the Senate.

Although Democratic leaders are telegraphing loud and clear they want to avoid any talk of impeachment, they still plan to investigate every possible Trump-related angle they can.

“The president is a guy who calls truth lies and lies truth,” House Oversight Committee ranking member Elijah Cummings (D-MD) told Vox this fall. “We’ve got to show what he is doing to take the foundation out of our democracy.”

Democrats also want to send a clear message they’re serious about cleaning up corruption in Washington; they are planning to take immediate action on a sweeping bill that would crack down on lobbying and expanding voting rights. That effort is being led by Maryland Rep. John Sarbanes, who is adamant his party needs to undergo a serious reckoning of its own when it comes to getting money out of politics.

“Walk the walk, and we’ve got to walk it quick,” Sarbanes told Vox recently. “A lot of [voters] don’t believe it can happen because the system is rigged.”

Nancy Pelosi really wants to be speaker again. A slim majority might not stop her.

House Leader Nancy Pelosi is now focused on how she can get to 218: the number of votes she needs to become House speaker.

Pelosi has been at the helm of House Democrats for 16 years but has spent just four of those in the majority as House speaker. She previously served as speaker from 2007 to 2011, after Democrats swept into power in the 2006 midterms.

Had Democrats returned to power in this election in larger numbers, her return to the speakership would have been almost assured, as few people have raised their voice to challenge her, and Pelosi would have been able to argue she effectively returned Democrats to power.

Democrats are indeed back in power in the House, but they’re not in the dominant position they’d hoped for.

Now, Pelosi must appease a Democratic caucus that’s been growing restless with the entrenched structure under her leadership, as well as the leadership of the other two top House Democrats: House Minority Whip Steny Hoyer (MD) and House Assistant Democratic Leader Jim Clyburn (SC). Hoyer plans to run for House majority leader — the No. 2 spot behind Pelosi. Clyburn could also be jockeying for that position.

Clyburn has indicated he will challenge Pelosi only if she falls short, and Hoyer has also coveted the speakership for years but won’t openly challenge Pelosi unless she doesn’t have enough support.

With a number of younger members complaining about the amount of time it takes to get a coveted committee chairmanship and leaving the House to pursue other political offices, and with a Congressional Black Caucus that wants more representation at the top, Pelosi will be juggling a lot of competing demands when she returns for leadership races. But she has tools to win over members. She and her allies argue her experience is an asset dealing with Trump and heading into 2020.

Pelosi has also been aggressively fundraising and campaigning in 2018, raising millions and breaking her past fundraising records earlier this year. That money will be an important incentive to win over the support of House members who may be on the fence, especially since the national Democratic Party will be so focused on beating Trump in 2020, when House members will also all be up for reelection.

Pelosi and her allies are confident, at least outwardly.

“We always assume Pelosi will be challenged,” a senior Democratic aide told Vox this summer. “No one can beat her in the caucus; that is the fundamental problem.”

Correction: An earlier version of this story misstated the party of Maryland Rep. John Sarbanes.