Charles Rex Arbogast / AP

Democrats have for more than a year gone to bat against a billionaire president and his Cabinet full of wealthy executives, railing against their conflicts of interest and accusing them of satisfying their lavish tastes on the taxpayers’ dime.

But in their quest to reclaim the governorship of the nation’s third-largest blue state, Democrats in Illinois have turned to a billionaire of their own to match up against the Republican multimillionaire in office, Bruce Rauner.

J.B. Pritzker, an entrepreneur, investor, and longtime Democratic donor, on Tuesday night easily defeated a son of Robert F. Kennedy and a liberal state senator to capture the party’s nomination ahead of a general-election campaign that’s expected to be the most expensive in state history. Pritzker won 45.4 percent of the vote to 26.5 percent for state Senator Daniel Biss and 24.2 percent for Chris Kennedy, who could not translate his family name into electoral success as a first-time candidate.

Pritzker will now face Rauner, whose status as the most vulnerable Republican in the country was laid bare by the fact that he nearly lost renomination for a second term to state Representative Jeanne Ives. With most precincts reporting, Rauner was up by just three points, 51.5 percent to 48.5 percent. Bolstering Democrats’ confidence heading into the fall, nearly twice as many people voted in their gubernatorial primary as for either Rauner or Ives.

“I’m J.B. Pritzker, and I’m going to beat Bruce Rauner,” the newly-minted Democratic nominee declared jauntily in the first words of his victory speech on Tuesday night.

Across statewide, federal, and local races on Tuesday, the Illinois campaigns featured a bit of everything.

There was Pritzker, the establishment-aligned billionaire, trying to hold off both a Kennedy scion and Biss, a younger liberal running under the Bernie Sanders banner. There was Rauner, the wounded Republican governor who nearly lost renomination for a second term to a conservative state legislator. In congressional races, a pair of women emerged from hard-fought Democratic primaries to take on vulnerable male Republican incumbents in general elections that could help determine control of the House. And in the state’s third congressional district, an energized coalition of progressives backing first-time candidate Marie Newman nearly—but not quite—toppled one of the most conservative Democrats in the House, Representative Dan Lipinski.

With most of the ballots counted, Lipinski led Newman by just 1,600 votes, or 1.8 percent. Newman initially wasn’t ready to concede after the increasingly bitter campaign, however, telling her supporters late Tuesday that she wanted Lipinski “to have a very painful night.” But she acknowledged the loss “by a thin margin” in a statement Wednesday morning, claiming credit for pushing Lipinski to the left on certain issues and vowing to “hold him accountable” going forward.

Newman’s defeat was a disappointment for progressive groups and particularly for groups like NARAL Pro-Choice America and EMILY’s List, which had hoped to punish one of the last remaining anti-abortion Democrats in Congress and make a statement on the party’s commitment to a woman’s right to choose.

For Lipinski, the primary battle was the toughest challenge he’s faced in years despite amassing a voting record that progressives had long believed was out of step with his solidly Democratic district. He inherited the Chicago-area seat from his father, Bill, who had held it since 1983 before resigning after the Democratic primary in 2004 so that party leaders could put Dan on the ballot in his place. Unabashedly anti-abortion, the younger Lipinski is one of just three Democrats remaining in the House who voted against the Affordable Care Act in 2010. “I don’t regret my vote,” he told me last month, although he pointed out that he opposed GOP efforts to repeal the law.

Newman had been politically active in the district, but this was her first run for office. She secured the backing of key progressive groups, including NARAL, EMILY’s List, the Progressive Change Campaign Committee, and Service Employees International Union. Leading liberal Democrats gave her bid a boost later in the race, as she won endorsements from Senators Bernie Sanders of Vermont and Kirsten Gillibrand of New York, as well as two veteran members of Illinois’s House delegation, Representatives Jan Schakowsky and Luis Gutierrez. Schakowsky told me it was the first time she had ever backed a primary challenge against one of her Democratic colleagues. Newman also drew support from several former aides to Barack Obama, who chafed at Lipinski’s attempt to tie himself to the former president after voting against key pieces of his agenda.

But Lipinski was able to hold on due to an advantage in money and the ground support of local trade unions and what remains of Chicago’s Democratic machine. Once the race made national headlines, he also drew help from the centrist group No Labels and the anti-abortion Susan B. Anthony List, which made a rare push to reelect a Democrat.

For national Democrats, the intra-party skirmish was a relatively easy fight to tolerate. Since Illinois’s third district is so solidly blue, the ouster of an incumbent would not risk throwing the seat into Republican hands—especially after the only GOP candidate to get on the ballot was a Holocaust-denier disavowed by the state party. Still, the primary created some awkwardness and tension in the Democratic caucus. The Democratic Congressional Campaign Committee only endorsed Lipinski under pressure from his allies in the Blue Dog Coalition, and Minority Leader Nancy Pelosi gave him a similarly unenthusiastic blessing.

Party leaders in Washington were more enthused about turnout of Democrats overall in Illinois, which swamped that of Republicans and gave them hope of picking up not only the governorship but several House seats as well. In the districts now held by GOP Representative Rodney Davis and Randy Hultgren, Democrats Betsy Dirksen Londrigan and Lauren Underwood easily defeated 10 men vying for the nominations. Kelly Mazeski, an EMILY’s List-backed candidate in the suburban Chicago sixth district, narrowly lost to Sean Casten for the right to take on Representative Peter Roskam.

But the marquee race remained the battle for governor.

Pritzker gives Democrats their own billionaire who can match Rauner dollar-for-dollar in what may be the party’s best chance to knock off an incumbent Republican governor this fall. Political analysts in Illinois said that any of the three main Democrats running—Pritzker, Kennedy, and Biss—would have started the general-election race as the front-runner against Rauner, whose ongoing budget battles with the heavily Democratic legislature have sunk his approval rating below that of President Trump. In a state that favored Hillary Clinton by 17 points in 2016 and where Democrats are expecting an energized turnout this fall, Rauner was already in trouble before Ives gave him a scare with a surprisingly strong challenge from the right.

“It’s the Democrats’ race to lose in November,” said Christopher Mooney, a political scientist at the University of Illinois-Chicago.

Pritzker has deep ties to the Democratic Party, both through his own campaign contributions and his family: His sister, Penny Pritzker, was a top fundraiser for former President Barack Obama and later commerce secretary. With a net worth of around $3.4 billion and the backing of most of the Illinois Democratic establishment, he’s already spent nearly $70 million to blanket the state with ads pitching himself as the best hope of defeating Rauner and fighting Trump. (Rauner doesn’t have quite that much of his own, having estimated his net worth at several hundred million dollars.) The money clearly helped him outpace both Kennedy and Biss, who called himself “the middle-class candidate” in contrast to his much wealthier opponents.

All three Democrats hailed from the Chicago area, but Pritzker’s self-funding allowed him to reach deeper across the state. “He’s had the money to do a lot more downstate than Biss or Kennedy have been able to do,” said Kent Redfield, a professor emeritus at the University of Illinois-Urbana.

But as a first-time candidate with deep ties to scandal-prone Democrats, Pritzker brings vulnerabilities of his own, which rivals Kennedy and Biss were able to exploit in narrowing his once-formidable lead in the polls. Chief among them was his association with former Governor Rod Blagojevich, the Democrat who was impeached and then imprisoned for trying the Senate seat vacated by Obama when he won the presidency in 2008. In tapes of recorded phone calls obtained by the Chicago Tribune, Pritzker and Blagojevich discussed his possible appointment to the Senate and other potential jobs. Pritzker had to apologize to black leaders and voters for disparaging comments he made about their potential Senate candidacies to Blagojevich.

Rauner is already running the recordings in TV ads, and the Pritzker-Blagojevich connection could linger in voters’ minds for another reason out of his control, Mooney said. “It also doesn’t help that Pritzker looks like Blagojevich’s fat little brother,” he told me. “They really look alike, except for the weight thing, so it’s a very uncomfortable thing for him.”

Rauner, meanwhile, has seen the base that elected him in 2014 erode over the course of his term. He’s been unable to steer his agenda through the Democratic legislature, which has repeatedly overridden his vetoes. “I am not in charge,” the governor once snapped in frustration, in words that his opponents in both parties quickly used against him. As a result, he’s been forced to run his reelection campaign not only against Pritzker but against the longtime Democratic party boss and state House speaker, Mike Madigan, vowing to roll back tax hikes and other legislation that passed during his own tenure as governor. “It’s a great agenda if you’re running the first time. But it’s a not great reelection message,” Redfield said. “It’s kind of like, ‘Gee, wouldn’t it have been great if you had been governor the last three-and-a-half years.’ But you were governor.”

The governor’s decision last fall to sign a bill expanding taxpayer-subsidized abortion angered conservatives and prompted Ives to enter the primary against him. She went after him aggressively, calling him “a fake Republican” and accusing him of kowtowing to Madigan on issues like abortion, immigration, and transgender rights.

In a victory speech on Tuesday night, Rauner congratulated Ives for a hard-fought race without mentioning her by name. “To those of you around the state of Illinois, let me be clear: I have heard you,” the governor said, acknowledging that it’s “been a difficult few years.” “I have traveled the state, and I have listened to you. While we disagree on some things, let’s commit to working together on what unites us—the reforms we need to save our state.” He vowed to continue fighting for lower taxes, growing jobs, and term limits.

“You have given me the chance to win the battle against the corruption that plagues Illinois,” Rauner said.

Rauner previewed his line of attack against Pritzker as a creature of Chicago and Springfield corruption. But the Democrat’s bigger liability may be his electoral inexperience among Illinois voters that, as Mooney put it, “appreciate professionals in politics.”

As Rauner’s own first-term struggles have demonstrated, wealthy political neophytes “haven’t fared that well” in Illinois, Mooney said. But Democrats largely overlooked Pritzker’s inexperience as an elected official. Like Republicans four years ago, they went for the money instead.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.