PEWAUKEE, Wis. — For months, Republican Gov. Scott Walker tried to warn supporters that his campaign was on shaky ground, to get out and knock on doors and vote, because the Far Left was riding a Blue Wave, and it was aimed right at him.

Voters in Wisconsin sunk his bid for a rare third term by a slim margin in favor of his Democratic opponent, the state’s schools superintendent, Tony Evers, 67, leaving the future of a man once considered one of the brightest stars of the conservative GOP firmament uncertain.

After a wild night of vote changes, Evers finally declared victory about 1:30 a.m. Wednesday, but Walker did not concede until the afternoon — tweeting that his camp had been waiting on some information on damaged outstanding ballots they eventually concluded would be insignificant in the final count.

Walker, 51, first elected in 2010, has been one of the most polarizing governors in the state’s history, beginning with his first months in office when he rode an early clash with organized labor to fame and survived a heated recall campaign the following year. He’s a hero to many conservatives, but voter after voter, especially teachers, will still say how angry and bitter they are about that union-busting episode.

Tuesday, younger, energetic Democrats, particularly in the “blue” urban areas around Milwaukee and the University of Wisconsin in Madison, turned out in large numbers to finally tip the balance against his traditional support in the red Milwaukee suburbs and Green Bay, according to Arnold Shober, an associate professor of government at Lawrence University. There were an estimated 6,000 more voters around Madison than in the previous governor’s race, he said.

On Wednesday, a jubilant Evers said he was confident that his margin of victory — a final vote percentage of 50 to 48 percent and a difference of 29,000 votes — would stand.

“The amount of enthusiasm this campaign has generated has been really rewarding,” Evers said in an interview. “It gives me great hope.”

Following Democratic House gains and Republican Senate gains, The Fix's Aaron Blake analyzes the winners and losers from the 2018 midterm elections. (JM Rieger/The Washington Post)

Evers is a former science teacher with a grandfatherly vibe, who traveled around the state in a rattle-y yellow school bus in the days before the election. He lacked Walker’s polish on the stump but was effective in calling out his opponent when Walker changed a key position on health care and mocking Walker’s claim of being the “Education President” after he engaged in years of school budget cutbacks and ended teacher tenure.

“In some ways, Evers was the perfect candidate . . . he’s had multiple statewide wins for an executive position, and he has also had to work with Walker, so he has been able to parlay that into effective attacks on the governor,” Shober said. In the end, Walker’s “programmatic, laserlike focus on fiscal conservatism” did not prevail, he noted.

On the stump, Walker had framed his argument for reelection around the state’s burgeoning economy, touting Wisconsin’s low unemployment rate — hovering around 3 percent — and strong wage growth. “If we get that message out,” he told reporters after a campaign event in Appleton on Sunday, “we win.”

During the waning days of the campaign, Walker was accused of handing out a grab-bag of election year treats, including a $100-per-child rebate and a sales tax holiday.

The two sides traded barbs over whether Walker supported the provision in the Affordable Care Act that prevents health insurers from denying coverage to patients with preexisting conditions. Walker insisted he did, even as the state joined a federal lawsuit seeking to block it.

Looming over the race was the outsized figure of the commander in chief, President Trump, who eked out a slim margin of victory of about 22,700 votes in Wisconsin in 2016, the first time the state went for a Republican candidate since Ronald Reagan in 1984. Although Trump came to campaign for him last month, Walker rarely mentioned him.

Analysts say that voters long ago made up their mind about Walker, with voters evenly divided about him throughout the recall effort and failed presidential bid through the present day, according to Barry C. Burden, a professor of political science at the University of Wisconsin in Madison.

“People just hate him horribly, or other people have signs in their yard,” said Marilyn Kinsman-Kharbush, 65, a cafe owner in central Reedsburg.

Walker, the son of a minister, came from modest circumstances and cultivated a regular guy image, with jokes about his $1 sweater from discount retailer Kohl's.

Progressives around the state, including teachers, still speak bitterly of the episode that propelled him to the national stage — 2011 legislation that eliminated most collective bargaining for public employees, known as Act 10, that sparked days of protest at the Capitol and eventually a failed recall effort backed by big labor.

“He made us the enemy. That was very hurtful,” said Jane Roberts, 76, a retired public school teacher.

Other saw him as a hero: “You’re just like Abraham Lincoln to me!” supporter Mary Ley, 53, gushed to Walker at one campaign stop.

Walker’s presidential hopes were dashed early; he was the first to leave the race in 2015, broke and thrown off-message by the Trump juggernaut. Yet his commitment to tax cuts and fiscal conservatism means he will likely remain a conservative icon with presidential aspirations — he ably outfundraised his opponent $31 million to $9 million, according to the Wisconsin Democracy Campaign. Americans for Prosperity, the main political arm of the influential Koch network, backed by billionaire industrialist Charles Koch and like-minded donors, spent $7.4 million in the state during the campaign.