RNC Chairwoman Ronna McDaniel said the party’s fundraising haul reflects voters’ optimism. (Jabin Botsford/The Washington Post)

President Trump's robust small-donor base helped the Republican National Committee vastly outraise its Democratic counterpart in 2017 as the two parties geared up for a crucial midterm campaign season, new Federal Election Commission filings show.

But Trump's polarizing effect also helped buoy the two Democratic congressional campaign committees, which pulled in more money than the GOP committees heading into the 2018 elections.

The RNC, the GOP House and Senate party committees and the two main Republican congressional super PACs together raised nearly $289 million in 2017, according to filings. Donations to the RNC made up nearly half of that total. And 44 percent of the $123 million raised by the RNC came from small-dollar contributions of less than $200.

The Democratic National Committee trailed far behind its Republican counterpart, raising $64.5 million in 2017. But the Democratic Senatorial Campaign Committee and the Democratic Congressional Campaign Committee last year outraised their respective GOP counterparts, the National Republican Senate Committee and the National Republican Congressional Committee.

In total, the three Democratic Party committees and two main Democratic congressional super PACs raised about $258 million in 2017, filings show.

Overall, the five Republican groups had about $30 million more cash on hand than the five Democratic groups combined.

Republicans are expected to face a tough defensive battle in this year's congressional elections. Historically, the president's party generally loses ground in the midterms. Trump's low approval rating — 36 percent, according to a January Washington Post-ABC News poll — poses a challenge for many Republican incumbents in swing districts, particularly in the face of energized grass-roots opposition on the left.

Democrats held a 12-point advantage among registered voters in the January Post-ABC News poll when asked whether they would support a Democrat or Republican in their district. According to election forecasters, Democrats need a six- to eight-point edge on this question in the fall to win enough seats to flip control of the House. A Post analysis of surveys conducted in the past month showed that Democrats hold an eight-point advantage on this survey question.

Still, Trump has galvanized small-dollar contributions from his base into the RNC, and the influx of such donations was key to the RNC's fundraising haul last year.

"Our strong fundraising numbers reflect voters' optimism and continued support as President Trump fulfills his promises to the American people," RNC Chairwoman Ronna McDaniel said in a statement. "In his first year, President Trump delivered a historic tax cut to the middle class, slashed regulations and grew our economy. We look forward to electing more Republican leaders to Congress who will support President Trump's winning agenda on behalf of the American people."

Trump entered 2018 with more than $32 million in the coffers of his reelection campaign and two affiliated committees, filings show.

Independent groups on the right also had a cash advantage.

The Congressional Leadership Fund, the super PAC allied with House Speaker Paul D. Ryan (R-Wis.), and the Senate Leadership Fund, the super PAC that backs Senate Majority Leader Mitch McConnell (R-Ky.) and his caucus, together raised about $40 million in 2017 — about $5 million more than their Democratic counterparts.

House Majority PAC and the Senate Majority PAC, which work to elect Democratic members in the House and the Senate, together raised about $35 million, filings show.

Among the biggest individual donors in the latter half of 2017 were Democratic media magnate Fred Eychaner, who gave $2 million each to House Majority PAC and Senate Majority PAC; George Marcus of Marcus & Millichap, a real estate brokerage firm, who gave $2 million to House Majority PAC; and Republican investor Kenneth Griffin, who gave $1 million to the Congressional Leadership Fund.

Congressional Leadership Fund officials said they plan to focus this year on promoting the new tax law, calling it essential to maintaining the Republican majority.

"Every Republican in Congress should be spending their time selling the tax plan. Anything else is a waste of time and money," said Courtney Alexander, spokeswoman for the Congressional Leadership Fund. "Convincing the middle class that Republicans cut their taxes is absolutely key to maintaining the majority in 2018."

The Congressional Leadership Fund and its affiliated political nonprofit, the American Action Network, together raised $66 million in 2017, according to officials and filings. The super PAC ended 2017 with $15 million cash on hand.

House Majority PAC raised about $15 million. The super PAC had $11.5 million cash on hand, not too far behind its Republican counterpart.

"We spend strategically to maximize Democratic wins and make sure Democrats are competitive across the map," said Jeb Fain, House Majority PAC spokesman. "As far as CLF goes, they've lit a ton of money on fire defending deep red districts and pushing deeply unpopular policies like a health-care plan that raises premiums and a tax scam that directs 80 percent of the tax cuts to the ultrarich. People just aren't buying it."

Scott Clement contributed to this report.