“When we join the Canadian family, we should not hide our identity,” Harper declared. “Never will I say to my daughter that a woman has to cover her face because she’s a woman.” Mulcair, for his part, accused Harper of attempting to “hide his record”—particularly on the flailing economy—“behind a niqab.”

The location of these comments was telling. Quebec’s determination to retain its French language and culture has made it fertile ground for nativism. Its previous Parti Québécois government sought to ban the use of conspicuous religious symbols by civil servants (the “conspicuous” qualifier allowed for small crosses, but excluded burkas, turbans, and yarmulkes), and to require citizens seeking services from them to keep their face uncovered. Quebec is also the NDP’s stronghold, a source of more than half the party’s seats in the last parliament. By exploiting hostility against Muslims, Harper could undermine Mulcair’s commanding lead in Quebec. Sure enough, the New Democrats’ support in Quebec dropped sharply during the last two weeks of September.

That same month, Harper’s campaign recruited the Australian election strategist Lynton Crosby, who has been accused of using dog-whistle appeals to anti-immigrant sentiment to, among other things, help engineer the British Conservative Party’s recent electoral victory. Encouraged by the shifting polls, Canada’s Conservatives piled on, announcing a police tip line citizens could call to snitch on neighbors’ “barbaric cultural practices.” The prime minister mused about banning civil servants from wearing Muslim head coverings.

A government-commissioned poll last March showed overwhelming public disapproval of women wearing the niqab during citizenship ceremonies. But disapproval is one thing; the specter of bureaucrats compelling women to remove clothing quite another. Canadians still like to think of themselves as tolerant and welcoming. By picking on an unpopular religious minority—Muslims constitute just 3.2 percent of Canada’s population—the government provoked widespread outrage. The Globe and Mail called the government’s tack a “culture war fabricated to take voters’ minds off the real and complex issues in this election.” The Toronto Star accused Harper of “relentlessly fanning hostility toward Muslims.” Canadians dismayed by the bigotry flocked to the sarcastic hashtag #BarbaricCulturalPractices to denounce everything from wearing socks with sandals to Harper’s refusal to investigate the cases of 582 missing and murdered aboriginal women in the country.

Sabotaging NDP support in Quebec had unintended consequences for the Conservatives. The NDP’s declining poll numbers signaled to anti-Harper voters that Liberal Justin Trudeau, son of Canada’s late Prime Minister Pierre Trudeau, was the better bet for defeating the current government. Trudeau outperformed Harper in a foreign-policy debate in late September, coming across not as the flaky naïf portrayed by the prime minister, but rather as a cheerful, energetic young man facing off against “two old grumps,” as one commentator put it. In the final days of the campaign, Trudeau’s Liberals have pulled ahead of the Conservatives and far ahead of the New Democrats, with some supporters of the latter apparently decamping to the more promising Trudeau. (The Liberals also suffered a setback this past week when Trudeau’s campaign co-chair resigned, after the disclosure of an email in which he advised an energy company on how to lobby Canada’s next government.)