House Minority Leader Nancy Pelosi of California speaks to supporters...

House Minority Leader Nancy Pelosi of California speaks to supporters during an election night returns event at the Hyatt Regency Hotel on Tuesday in Washington. Credit: AP / Jacquelyn Martin

For House Democrats, the midterm election was a tale of two cities: Brooklyn, New York, and Brooklyn, Iowa. Brooklyn, New York, is about ethnic foods, diversity and urbanism. The Brooklyn in the 1st Congressional District of Iowa is about Cedar Rapids, corn and soybean fields.

What House Democrats accomplished Tuesday night eluded them in past midterms: They won congressional districts that include both Brooklyns. They turned out their base and attracted swing voters. What played in Dumbo also played in Dubuque.

Now, House Democrats have to transition from a successful political strategy to a successful governing strategy. That will be complicated by a continued Republican majority in the Senate.

First, the politics.

House Democrats succeeded by understanding that all messaging is local. At the outset of this midterm election, they faced the typical drama and recriminations about the lack of a national message. To their credit, they didn’t strum the same bland chords. Instead, they encouraged candidates to stay in tune with their voters. That versatility made the difference. In Kings County, New York, Democrats may have been talking about impeachment. In Poweshiek County, Iowa, they were focused on flood mitigation in Cedar Rapids.

Democrats also established early energy in both red and blue districts — putting more than 70 districts in play. To put that in perspective, when I chaired the Democratic Congressional Campaign Committee, we had a total battlefield of 25 to 30 seats. To Republicans’ credit, they surprisingly closed in on Democratic intensity levels in the few weeks immediately before the midterms.

But it’s moderate, swing voters who represented the final wave of intensity, and they broke strongly for House Democrats on Tuesday. President Donald Trump intensified independent voters’ support for Democrats by his verbal barrages in the closing arguments of the election: blaming the media for hatred that helped inspire the synagogue shooting in Pittsburgh as well as the attempted pipe-bombings of prominent Democrats, and additionally, stoking fears of the migrant caravan in Central America and Mexico. He reminded many independent voters — even those who may not dislike him — that he’s a president whose impulses and excesses require restraint.

The political lesson here is that fomenting the frothing base of the Trump movement doesn’t win national elections. Swing voters in Brooklyn, Iowa, do.

Second, having secured a license from crossover voters in moderate districts, House Democrats now must prove that they can drive — not to the left or to the right — but forward. I hope they’ll launch an aggressive legislative agenda that works interchangeably to improve the lives of Brooklynites in both New York and Iowa.

Here’s what it should include: rebuilding America’s infrastructure to sustain economic growth and reducing the cost of prescription drugs. Those are two issues that Trump promised to deliver to the American people and which Democrats are ready to negotiate. Democrats also should push for ethics reform in Washington. There’s a sense among voters across America that gerrymandering and superPACs have irreparably broken democracy. A House Democratic majority that reduces the influence of money in elections, and requires full transparency into all donations, will keep faith with voters.

Finally, Democrats can’t dominate the news with internecine warfare. They have to focus on outside the Beltway, not inside.

The midterms are over and the presidential race is two years away. In between, the Democrats have a chance to not just act as a check against Trump, but to bolster paychecks. Governing for the people of Brooklyn, Iowa, and the people of Brooklyn, New York, is the key to the Democrats’ sustained success.

Steve Israel is a former Democratic congressman from Huntington.