ST. PAUL, Minn. (AP) — Minnesota Democrats were settling a three-way battle for governor in Tuesday’s stacked primary election, while former two-term Gov. Tim Pawlenty sought to win back his old job on the Republican side.

Democratic Gov. Mark Dayton’s departure had his party scrambling to hang on to what could be their only lever of power if they don’t take the state House later this year.

READ MORE: Kim Potter Trial, Dec. 2 Live Updates: 5 Jury Spots Yet To Be Filled

Pawlenty was the heavy favorite to win the GOP primary, with a massive fundraising advantage and a much higher profile than Hennepin County Commissioner Jeff Johnson. Johnson had the party’s support but faced a constant ad barrage from Pawlenty and also was saddled with his loss to Dayton just four years earlier.

Pawlenty and Johnson ended their primary campaign much the way it began — with Johnson touting his support among GOP party activists, Pawlenty calling Johnson unelectable statewide after his 2014 loss to Dayton and the pair squabbling over who insulted President Donald Trump worse ahead of the 2016 presidential election.

Pawlenty’s critique that Trump was “unhinged and unfit for the presidency” just weeks before Election Day was a constant on the campaign trail, with Johnson gleefully reminding voters of his opponent’s remarks. It was part of why Johnson tried to brand Pawlenty as part of the “status quo,” positioning himself as the true conservative as compared to Pawlenty, who headed to Washington, D.C., after leaving office in 2011 to lobby for some of the nation’s largest banks.

READ MORE: 2 Of 4 Charged In Greenvale Township Death Plead Guilty

And Democrats’ three-way primary turned ugly in its final days. Attorney General Lori Swanson, who entered the race at the last minute and then spent most of her two-month campaign on advertisements rather than public appearances, launched a late attack ad on U.S. Rep. Tim Walz for missing more than 60 percent of congressional votes in 2018.

Swanson faced late accusations that she had pressured staffers in her office to volunteer in her political campaigns. She punched back, calling one accuser a “liar” and saying she had never compelled political work. She also suffered a setback when her running mate, U.S. Rep. Rick Nolan, was accused of mishandling sexual harassment allegations against an aide in his congressional office.

Walz’s six terms in Congress and Swanson’s three as attorney general made them more recognizable to voters, but it was state Rep. Erin Murphy who carried the party’s endorsement. She staked out more liberal ground than either one, and was hoping Dayton’s backing would give a boost.

Swanson, meanwhile, stuck to more moderate positions. She said she wouldn’t support legalizing recreational marijuana and would merely set up a task force to study giving driver’s licenses to immigrants living in the state illegally. Murphy and Walz both said they’d push for both policies outright.

MORE NEWS: St. Paul School Board Votes To Close 6 Schools Amid Declining Enrollment, Sustainability Concerns 

(© Copyright 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)