LANSING, Mich. — Strong feelings about President Donald Trump, a competitive governor's race and congressional retirements fueled what probably was record turnout for a Michigan primary, with more than half-million more people voting than in 2010 — the last time the governorship was open.

Nearly 2.2 million votes were cast, a 28 percent spike over the 1.7 million mark from 2002, which is believed to be the previous record. Just over 28 percent of the voting-age population cast ballots, an upturn over the previous high of 24 percent from 1982. Turnout numbers posted online only go back 40 years.

Analysts attribute the surge in voter engagement to angst over and backing for Trump along with a ballot that had a number of high-profile, high-dollar open races on both sides. At least $23 million was spent airing broadcast TV ads across the state, including nearly $17 million on governor's races won by Democrat Gretchen Whitmer and Republican Bill Schuette.

More than 1.1 million people voted in the Democratic gubernatorial contest, double the number in the 2010 race, and about 140,000 more than the nearly 1 million who voted in the Republican primary.

Michigan, where Republicans have controlled state government for 7½ years, is an important gauge of whether Democrats can make gains in the upper Midwest after Trump won the state in 2016.

Pollster Bernie Porn of EPIC-MRA in Lansing said Trump, whose endorsements of Schuette and John James helped carry them to wins, energized both the Republican and Democratic bases to vote on Tuesday. Other states such as Illinois, California and Montana have seen high number of voters this year, too.

"It's a big warning sign for Republicans," said Michigan Democratic Party Chairman Brandon Dillon. "It's not very often that we overperform them in primary turnout, especially when you have equally competitive primaries on both sides."

He noted that more Democrats than Republicans voted in suburban Detroit's Oakland and Macomb counties, key bellwethers in statewide general elections. Some Oakland precincts ran out of ballots, possibly due to higher-than-expected turnout.

"It's not totally predictive, but I think it's a very good sign that we're going to have an engaged, excited Democratic electorate turning out in November," said Dillon, whose party has struggled with turnout in past midterm elections.

Republicans say they expected higher Democratic turnout. They cite hostility toward Trump, spending on top races and recent visits to the state from Vermont Sen. Bernie Sanders and upstart New York congressional candidate Alexandria Ocasio-Cortez to boost Democrat Abdul El-Sayed, who lost to Whitmer.

"The blue wave, it's a thing. We're aware of it. But with our ground game and our fundraising capabilities, we feel like if we pack our raingear — if we come prepared — we're going to be just fine," said state GOP spokeswoman Sarah Anderson. She said while the president's party typically faces rough sledding in his first midterm election, Michigan Republicans have a better record of getting out the vote than Democrats do.

"Our voters will come home. The people who are supportive of the president are very supportive, they're very enthusiastic," said Anderson, adding that the GOP also will have to appeal to independent swing voters.

A key reason for the turnout boost was the number of competitive House races in metropolitan Detroit, said Lansing-based pollster Ed Sarpolus of Target-Insyght. The resignation of 27-term Democrat John Conyers — who left after allegations of sexual harassment — and the coming retirements of 18-term Democrat Sandy Levin and two-term Republican Dave Trott sparked intense fights to succeed them.