A bitter and bruising Democratic primary for Philadelphia district attorney comes to a close Tuesday.

Incumbent DA Larry Krasner has spent his first term pushing to reform what he calls an unjust system, focusing on exonerating people wrongly convicted and reducing mass incarceration.

Challenger Carlos Vega, a longtime homicide prosecutor whom Krasner fired in 2018, has promised to continue reforms while returning to a more traditional approach to prosecution and collaboration with police. Vega and his allies in the local police union blame Krasner for surging homicides and gun crimes, which are roughly in line with national trends during the pandemic.

In heavily Democratic Philadelphia, Tuesday’s winner is all but certain to win the November general election against lawyer Chuck Peruto, the only Republican candidate. Krasner is seen as the favorite to win the primary, but political watchers credit Vega with making it a competitive race.

» READ MORE: The voters who will choose Philly’s next DA aren’t the people with the most at stake

With voters heading to the polls — if they haven’t already cast ballots by mail — here are some factors that will help determine the winner.

How many people will actually vote?

Races for district attorney take place in off-year elections, which typically attract far fewer voters than contests for mayor, governor, Congress, or president.

So while the rhetoric has been fiery, the voters tuning into it likely make up a very small fraction of the electorate. Turnout in DA’s races has been light in the past three decades, sometimes not even cracking 10%. Krasner prevailed in 2017 with 38% of the vote in a seven-candidate primary, but just under 20% of the city’s Democrats cast a ballot.

In the 2017 primary, there were slightly more than 155,000 Democratic votes cast for district attorney. It’s hard to predict what turnout will be this year following the expansion of mail voting — roughly half of Philadelphia’s votes were cast by mail last year. But registered Democrats had returned about 47,000 mail ballots in the city as of Monday morning, which suggests extremely low turnout.

» READ MORE: Philly elected Larry Krasner district attorney to reform the system. Here’s what he did.

Campaign advertising, which can help mobilize voters, has also been notably light this year, especially considering the stakes. In 2017, a political action committee funded by billionaire George Soros spent almost $1.7 million to help Krasner win.

Krasner has been the biggest spender in this year’s race, shelling out almost $160,000 in television and radio ads, according to the advertising tracking firm AdImpact. Protect Our Police PAC, an anti-Krasner group founded last summer by retired cops, has spent almost $134,000 on TV ads. A related Soros group spent $90,000 in radio ads backing Krasner.

Vega put $30,000 into a last-minute radio ad touting his endorsement from former Gov. Ed Rendell, who served two terms as district attorney. He spent $366,000 mailing campaign literature to voters. But he did not air TV ads during the campaign.

Did the FOP really get Republicans to switch parties to vote for Vega?

The FOP encouraged Republican voters in the city to register as Democrats to support Vega in the primary. City data shows 6,252 Republicans switched over this year. Three out of every five party-flippers live in 14 wards in Northeast Philadelphia, where the FOP is based, and where Vega hopes to perform strongly.

But voters change parties for plenty of reasons. The city has more than one million voters, with 77% Democrats, 11% Republicans, and 12% independents or members of smaller political parties.

Krasner has been happy to highlight the FOP’s opposition to his reelection. He frequently links Vega to the FOP, which had a friendly relationship with former President Donald Trump and connections to the Proud Boys, a self-described “Western chauvinist” organization designated by the Southern Poverty Law Center as a hate group. The FOP represents about 14,000 active and retired officers, although many no longer live in Philadelphia.

» READ MORE: Carlos Vega’s campaign to be Philly DA started in his mom’s bodega

Vega, in a radio debate with Krasner last week, predicted he will “be at odds with the FOP many times” if elected because he will push for reforms in city policing.

“I am not owned by the FOP,” he said.

But Krasner was still at it Friday as he accepted the endorsement of the Guardians Civic League, which represents 1,500 active and retired Black police officers. He criticized the FOP leadership, saying they cater to retired white officers who long for the days of Police Commissioner-turned Mayor Frank Rizzo.

“They are a very diverse group of people,” Krasner said of police. “And many of them want what we all want, which is the system that is balanced and fair and just and that is not racist.”

Results from far Northeast Philadelphia, the Delaware River Wards, and Girard Estates will show whether the FOP’s efforts translated into votes.

With Trump gone, can progressives stay engaged?

Krasner’s promises of reforms in 2017 helped mobilize progressive voters still smarting from Pennsylvania’s role in helping to elect Trump. With Trump now out of office, will that enthusiasm wane?

Progressive groups such as Reclaim Philadelphia and the Pennsylvania Working Families Party say they are all in to defend Krasner, whose first victory was a watershed moment for their movement. But there’s concern on the left that Trump’s absence and the difficulty of generating enthusiasm for an incumbent with a complicated record will dampen their impact.

» READ MORE: Larry Krasner has progressives in a new position: Defending a controversial incumbent

Even Reclaim’s endorsement of Krasner highlighted frustration with the pace of reform, praising the incumbent’s efforts to hold police accountable but saying he “has failed to implement the transformative change needed to dismantle a fundamentally unjust and unequal system.”

Krasner got some 11th-hour help from U.S. Sen. Bernie Sanders (I., Vt.), who endorsed Krasner in early May and sent out an email blast on Monday encouraging supporters to “have his back when it matters most, to make sure he can continue our collective struggle for justice from the DA’s office.”

Turnout and Krasner’s margin of victory in neighborhoods such as Fishtown, Cedar Park, Center City, and parts of South Philadelphia east of Broad Street will show whether the progressive movement held its ground.