Listen to Pat Kessler’s new podcast!

MINNEAPOLIS (AP) — More than half of Minnesotans were not even alive when the state last elected a Republican attorney general.

The last GOP attorney general won the office in 1966. But this year’s contest between Democrat Keith Ellison and Republican Doug Wardlow has been tight. And it comes to a head Tuesday after a season of unexpected twists and turns, with each candidate bitterly calling the other extreme.

Attorney General Lori Swanson waited until June before announcing that she would run for governor instead of seeking a fourth term. Ellison quickly decided to give up his safe Minneapolis-area congressional seat to seek her job instead. Then his ex-girlfriend accused him of domestic abuse.

RELATED: WCCO Election Guide

Suddenly the virtually unknown Wardlow — who was a lawyer for a conservative Christian legal advocacy group — became a realistic contender. A Star Tribune/Minnesota Public Radio poll last month gave Wardlow a slight lead. The last GOP attorney general, Doug Head, served one term before losing the 1970 gubernatorial race to Democrat Wendell Anderson.

Ellison has been a national political figure since 2006, when, after serving two terms as a state representative, he became the first Muslim elected to Congress.

Paul Taklo, 48, a designer in Minnetonka, said he voted for Wardlow. Taklo described himself as a conservative with libertarian beliefs who generally votes Republican.

“I just don’t care for Ellison,” Taklo said. “It’s the liberal aspect of him.”

David Galle, 49, a lawyer in Minneapolis, backed Ellison in early voting Monday, calling him a strong supporter of Minneapolis and the state.

“Was I disheartened with some of the, you know, coverage — yes, it certainly is messy, but as far as his approach to Minnesota versus his challenger, he was for me the clear choice,” Galle said.

A leader in the Bernie Sanders wing of the Democratic Party, he became deputy chairman of the Democratic National Committee last year. Then his former girlfriend accused him over the summer of dragging her off a bed during an argument in 2016. Ellison repeatedly denied her allegations.

Not only did Ellison become a lightning rod in the attorney general’s race, Republicans in other races attacked their Democratic opponents for failing to denounce him. While an investigation commissioned by Democratic leaders declared the allegations unsubstantiated, Wardlow called it a whitewash.

During Wardlow’s single term in the Minnesota House, he backed so-called right-to-work legislation to block unions from collecting mandatory dues. He also tried unsuccessfully to stop the state from setting up the MNsure health insurance exchange.

After losing in 2012, he joined the Alliance Defending Freedom, leading its unsuccessful fight in a U.S. Supreme Court case that legalized same-sex marriage in 2015. He also litigated against letting transgender students use bathrooms of their choice. And he defended a Michigan funeral home that fired a transgender employee.

Ellison vowed to use the attorney general’s office to fight President Donald Trump on immigration and other issues. While Wardlow presented himself as an apolitical alternative, he was recorded as saying at a private event that he wanted to fire 42 Democratic attorneys and replace them with Republicans. He said he misspoke.

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