CALGARY -- He's hip, funny, well-educated and widely known across Canada, but Naheed Nenshi is facing the fight of his political life as he seeks his third term as Calgary's mayor.

During his two previous terms, Nenshi was named the No. 1 mayor in the world by an international urban research institute and feted with the World Mayor Prize in 2014. He has been praised as an "urban visionary," who doesn't neglect the nitty-gritty of local government.

But Calgary's struggling economy and a number of missteps have opened the door in Monday's civic election for Bill Smith, 54, a Calgary lawyer and former firefighter who was president of Alberta's Progressive Conservative Party.

"A month ago we were all saying that it's hard to kick out an incumbent and Bill Smith had no name recognition back then," said independent pollster Janet Brown.

"The fact that we're even thinking it's a competitive race is unprecedented in Calgary politics. We haven't seen an incumbent mayor defeated since Ralph Klein won in the early '80s."

Nenshi said he never expected to sleepwalk through this campaign.

"OK, maybe I'm irritating. Maybe you don't want to have a coffee with me," Nenshi said Friday. "But I think what we really should be making decisions on is what kind of a community are we trying to build."

The campaign has been a lot less fun than previous years, he admitted.

"It has been nasty. It's been vitriolic," he said. "The thing about me is that I put myself out there every single day. And like Popeye, 'I yam what I yam.' I don't try to hide it."

Smith said Calgarians are frustrated with rising taxes, high office-vacancy rates and a struggling economy.

"Nobody sees any hope in sight in terms of a recovery on the energy side. What we're getting is increased taxes at the civic level, at the provincial level and the federal level," said Smith. "There's just a real general feeling of discontent."

Brown said a couple of issues seem to have come back to haunt Nenshi.

There was a war of words with a Calgary developer that led to legal action. Nenshi had to pay $300,000 in legal bills and received help raising the money from a Calgary group.

Last year, Nenshi apologized for calling Uber "the worst of people" and its CEO a "dick" in a widely circulated video while he was using a competing ride-hailing service in Boston.

"That again brought questions around his respect for others," said Lori Williams, a political scientist at Mount Royal University.

"This image of him of being sort of arrogant and combative, he thinks he's the smartest person in the room, and things like that ... seems to be hurting him as well."

Williams said unlike other civic elections, this one has become partisan with traditional party loyalties entering into it.

"There are a number of small-c conservatives who seem to be engaging in this race."

Brown said some may be taking frustrations with Premier Rachel Notley and Prime Minister Justin Trudeau out on Nenshi.

"There's a lot of anger, and with the cancellation of Energy East, perhaps Calgarians would like to punish Trudeau. Perhaps they would like to punish Notley, but they don't have an opportunity to do that," she said.

Nenshi has complained about an increasing presence of racism and hateful language in social media discourse coming from forces supporting his opponents and wanting to "take the city backwards."

Brown said she doesn't doubt that Nenshi, the first Muslim mayor of a major Canadian city, has encountered racism, but suggested his comments could backfire.

"It came out as meaning if you're against me, you're racist," Brown said.

"It didn't really acknowledge that there are some legitimate reasons to dislike Mayor Nenshi and be voting against Mayor Nenshi that has nothing to do with his race."

-- With files from Lauren Krugel.