Liberal candidate Richard Hébert won Monday's federal byelection in Quebec, while Conservative candidate Dane Lloyd won in the riding of Sturgeon River-Parkland, west of Edmonton.

Richard Hébert, the outgoing mayor of Dolbeau-Mistassini, was born and raised in the riding of Lac-Saint-Jean, serving as a mayor since November 2013.

Hébert's riding is heavily dependent on the logging industry and, as such, he will be expected to bring his advocacy for the industry, and concern over recent tariffs slapped on Canadian softwood, to Ottawa.

No surprise in Alberta vote, but Quebec riding goes red after nearly four decades 1:09

A Liberal victory in Quebec's nationalist heartland — where the party hasn't won since 1980 and where it posted its worst result in the province in 2015 — would have been remarkable at any time.

But it was particularly sweet for the prime minister on Monday, coming at time when his government has been mired for weeks in controversy over small business tax reform proposals, the personal finances and ethics of his finance minister and a new cultural policy that's been especially panned in Quebec.

Pushed for new law

Lloyd, 26, is a military reservist who recently worked as a parliamentary assistant for Michael Cooper, the Conservative MP for St. Albert-Edmonton.

During the campaign, Lloyd said he would push for a law where convicted murderers are made ineligible for parole unless they reveal what they did with their victim's bodies.

Lloyd has a history of posting controversial views in social media, easily retained the Edmonton riding of Sturgeon River-Parkland with 77 per cent of the vote.

Among other things, Lloyd has referred to women's advocates as "Feminazis" and started a Facebook campaign to create a Canadian chapter of the National Rifle Association.

NDP, Liberals falter in Alberta

The byelections, which come just after the two-year anniversary of Prime Minister Justin Trudeau election victory, mark the first time newly minted Conservative Leader Andrew Scheer and NDP Leader Jagmeet Singh were tested at the polls.

Lloyd's win was no surprise, where the previous MP, Rona Ambrose, last won the riding with more than 70 per cent of the vote during the 2015 federal election.

Still, the NDP's Shawna Gawreluck and the Liberals Brian Gold were hoping for an improvement on their party's 2015 performances, when the NDP took just 10 per cent of the vote and the Liberals didn't do much better, with 15.6 per cent.

But the NDP and the Liberals fared slightly worse, with 7.7 per cent and 12 per cent, respectively.

Battleground Quebec

In the riding of Lac-Saint-Jean, however, the results proved more difficult to predict.

While former Conservative MP Denis Lebel won the riding in 2015, he did so with just 33.3 per cent of the vote, closely followed by the NDP, which took 28 per cent. The Liberals and the Bloc Québécois both took 18.4 per cent while the Green Party of Canada came away with just 1.5 per cent of the vote.

The NDP's Gisèle Dallaire was hoping to win a seat in the province that gave her party 16 of its 44 MPs in the last election, but there appears to have been a dramatic shift in voter preferences in the riding.

The NDP only took 11.7 per cent of the vote, finishing behind the Conservatives candidate Rémy Leclerc with 25 per cent and the Bloc's Marc Maltais whose tally stood at 23.4 per cent of the vote.

The Liberals won with 38.6 per cent of the vote.

Conservative candidate Dane Lloyd won in the riding of Sturgeon River-Parkland, west of Edmonton. (Dane Lloyd Campaign)

Lebel first won the riding in a byelection in 2007, improving the party's performance by 23 per cent over the 2006 election. Lebel had the advantage of being a local mayor in the area with the name recognition that comes with it.

This time, however, it was Hébert who appeared to use his local profile to winning effect. He was accompanied by Trudeau last week on the campaign trail in a move that suggests the Liberals were serious about taking the seat. Trudeau also campaigned with Gold in Alberta.