New York Mayor Bill de Blasio gives the keynote speech at Progress Iowa’s holiday party last month in Des Moines. (Charlie Neibergall/AP)

As Republicans celebrated their tax bill passing Congress late last month, Iowa Democrats raised a toast of their own. Candidates for Congress and governor, gathered at the annual Progress Iowa holiday party, took turns recapping a year of sinking GOP poll numbers and Democratic ­special-election wins — the “waking of a sleeping bear,” they said.

“If Trump were to run again, he’d be in deep trouble,” said Janet Petersen, the leader of Iowa’s Senate Democrats. “A dog bites you the first time, it’s not your fault. The second time it bites you, it’s your own damn fault.”

Iowa, the epicenter of the Republicans’ 2014 and 2016 surge, is not an obvious place for a Democratic comeback. Unemployment, sinking under 4 percent when Donald Trump won the state, has fallen to 3 percent. Iowa’s Republican delegation to Washington voted for the tax cut bill with no qualms or protests. Iowans can also subtract their federal income taxes from their state income taxes, a bonus enjoyed in only five other states.

Despite it all, Iowa has seemingly soured on the president and his party. The end-of-year Iowa Poll, an industry standard conducted by Des Moines-based Selzer and Co., found Trump with just 35 percent approval in the state. Only 34 percent of Iowans said they would back Republicans for Congress in 2018, and 61 percent said they were turned off by politics altogether.

The discrepancy between the rosy economic picture and the public’s distaste for Trump in Iowa has confounded both parties and complicated one of the major political stories of the decade — the Republican romp through the Midwest.

The Post's polling team analyzed Virginia's 2017 gubernatorial race to see if a "Trump effect" was at play. (Monica Akhtar/The Washington Post)

Why Iowa has turned against Trump and Republicans is a mystery that both parties are eager to figure out ahead of the 2018 midterms, looking to understand whether it’s an aberration or a sign of a greater political trend.

Republicans took charge of Iowa’s legislature last January and since then have advanced the agenda they promised voters — pushing through tax cuts, passing labor rules that require unions to hold fresh elections and maintaining a privatized version of the Affordable Care Act’s Medicaid expansion.

Some conservatives saw it as a strong start and suggested polling that showed dark voter moods about Republican governance reflected a cynicism that would fade as the policies took effect.

“You’ve got record consumer activity. The market is high. Job growth numbers are impressive,” said Drew Klein, the Iowa director of the conservative grass-roots group Americans for Prosperity. “Now, if you ask somebody, ‘Is this something you feel?,’ they might say no. But this is stuff that affects them down the line.”

Few states had so loudly invited Republicans to try it their way. A swing state for decades, Iowa broke so dramatically in 2016 that Democrats wondered if it had become a demographic write-off. Thirty-one of Iowa’s 99 counties voted for Barack Obama twice, then flipped in 2016 to support Donald Trump. Just 41.7 percent of Iowans backed Hillary Clinton for president, the weakest showing for a Democratic presidential candidate since 1980.

For the first half of the year, Democrats looked at Iowa as a cautionary tale. White voters without college degrees had wiped the party out in the eastern part of the state, where it had always won strong. National groups had tied Rep. Rod Blum (R) to Trump, expecting a wipeout in a district that had voted for Obama by 14 points in 2012. But Trump won the district, and Blum, a member of the House Freedom Caucus, became a reliable voter for his agenda.

Even Obama, in a subdued post-election news conference, cited Iowa as the place where Democrats lost their drive.

Democrats at Progress Iowa gathering were optimistic about their prospects in the state. (Charlie Neibergall/AP)

“I won Iowa not because the demographics dictated that I would win Iowa,” he said. “It was because I spent 87 days going to every small town and fair and fish fry and VFW hall, and there were some counties where I might have lost, but maybe I lost by 20 points instead of 50 points.”

Now, Iowa Democrats believe they’ve begun the climb back. On Jan. 31, the party easily held a state House seat in the first special election of the Trump era. On Aug. 8, it did the same, but in a southeast Iowa district where Trump had won by 21.3 points. And on Dec. 12, when most national political attention was focused on Alabama, Democrats lost a special state Senate race in red northwest Iowa by nine points. The seat had been so safely Republican that Democrats had not run a candidate in 2010 or 2014.

Jeff Kaufmann, the Iowa GOP chairman who has presided over the Republican surge, did not sugarcoat the matter. “They’ve picked good candidates, and there may have been a complacency factor on the part of Republicans,” Kaufmann said. “I see that Senate race as a wake-up call.”

It wasn’t clear to Kaufmann whether the Trump administration would help or hurt going forward. In other parts of the Midwest, Trump’s promise to pull out of NAFTA or to renegotiate the treaty drew Democratic voters away from Clinton. In Iowa, Trump’s trade protectionism was a risk and came during a slump for farmers who depend on open markets. Longtime governor Terry Branstad (R) left Des Moines to become the administration’s ambassador to China, and his successor, Gov. Kim Reynolds (R), has found herself lobbying the administration to go slow on changes to trade policy.

“Whenever we talk about pulling out, commodity prices are affected immediately, and that will be one of the first casualties that we’ll see,” Reynolds said at a Dec. 19 news conference. “So we’re going to hold them accountable.”

The out-of-power Democrats hope to take advantage of the simmering Trump angst, even if they were surprised in 2016. At the Progress Iowa gala on Dec. 19, where New York Mayor Bill de Blasio gave the keynote speech, Democrats talked confidently about running against the just-passed tax cut. It was, they said, going to sail right past the sort of Iowans who had trusted the GOP the previous year.

“They’re going to see who the winners and losers are in this, and they’re going to identify the corporations and wealthy people who came out way ahead of their families,” said Nate Boulton, a state senator who is running for governor in 2018.

Some of the Democrats’ takes on the tax cut began to sound like talking points. Locked out of power and watching Republicans preside over a growing economy, they were still optimistic that the state’s new rulers would give them issues to run on. Policies favored by conservative groups such as Americans for Prosperity had sometimes divided Republicans. A conservative dream bill that would have ended professional licensing requirements for barbers, therapists and other skill-based professions was stopped by Republicans; state Rep. Bobby Kaufmann (R), son of the state party chairman, dramatically ripped a copy of the proposal in half.

Jeff Kaufmann, cognizant of how Democrats could run against his party, expected the state’s economic picture to block them. “If the economy’s good, I don’t know if a lot of voters’ analysis is going to go beyond that,” he said.

Other Republicans were all-in on the federal GOP agenda. In a short interview, Blum said he was confident that the tax cut package — like the president, suddenly unpopular in Iowa — would become a boon for the party.

“People will see the benefits in their first paychecks in January,” Blum said. “Their 401(k)s are 40 percent higher since November of last year. They’re going to be retiring earlier. And if they’re working, companies are going to be hiring more.”

Asked about the Iowa Poll, Blum said he had not seen it.

“I don’t pay attention to politics,” he said. “I really don’t.”