OTTAWA (Reuters) - Andrew Scheer, a social conservative who unexpectedly won the race to head Canada’s main opposition party, is a popular legislator who may be able to unite a divided movement as he prepares to take on Prime Minister Justin Trudeau.

Andrew Scheer speaks after winning the leadership during the Conservative Party of Canada leadership convention in Toronto, Ontario, Canada May 27, 2017. REUTERS/Mark Blinch

The low-profile 38-year-old former speaker of the House of Commons was elected leader of the right-leaning Conservatives on Saturday after 13 ballots, beating ex-foreign minister Maxime Bernier by just two percentage points.

“Andrew Who?” said a front-page headline in Sunday’s Toronto Star, reflecting widespread surprise at the outcome.

The tight election reflects a split between members who want to debate abortion and same-sex marriage - which are legal in Canada - and those who prefer to focus on fiscal issues.

“There’s some common ground between libertarians and fiscal conservatives and foreign affairs conservatives. So my job is to find the very best of all of that,” Scheer told CTV television on Sunday.

Scheer is well-liked inside the party and should benefit from four years as House speaker, a job that requires good relations with all Parliamentarians, said Kathy Brock, political science professor at Queen’s University in Kingston.

“He’s young, he’s dynamic, he knows how to work with people, having been Speaker, so that’s a good result for the Conservatives. They have got a nice alternative to Trudeau,” she said in a phone interview.

Influential Conservative Jason Kenney praised Scheer, calling him “truly one of the nicest, most decent, and genuine people I know,” a sign that party leaders are rallying behind Scheer.

The result marked another setback for populists who hoped their popularity was on the rise around the globe after Republican Donald Trump won last year’s U.S. presidential election.

Slideshow ( 5 images )

Hard line Conservative leadership contenders - including one who proposed would-be immigrants pass a “Canadian values” test - did poorly. That follows losses of far-right populist candidates in France and the Netherlands.

“Canadians have always been more receptive by a significant degree than Americans to immigration,” said Brock.

Scheer, who like the 45-year-old Trudeau smiles a lot and has a young family, must now prepare for an election in October 2019.

Although he will inherit a fundraising machine that generates twice as much money as the Liberals, a Nanos Research survey last week gave the Liberals a massive 14-point lead.

“It’s not enough for the Conservatives just to elect a leader that could turn things around for them. They actually need the Liberals to make mistakes in order to move the numbers,” pollster Nik Nanos said in a phone interview.

Still, Nanos predicted that Scheer is well positioned for the battle, saying he could take on the role of a “common man” challenging a “celebrity politician.”

The Conservatives need to pull together a credible economic plan to demonstrate that they can beat Trudeau’s Liberals, who are running much larger budget deficits than promised, analysts said.

Scheer has vowed to eliminate the shortfall in two years, without giving many details.

One challenge he faces is that he is promoting policies similar to those of former Conservative Prime Minister Stephen Harper, a dour politician who lost power in 2015 in part thanks to voter weariness with his combative stance.

Canada’s steadily recovering from a prolonged shock caused by the slump in prices of crude oil, a major Canadian export.

Scheer’s economic agenda includes tax cuts and opposition to Trudeau’s plans for a national carbon price.

Scheer praised Harper, who frustrated social conservatives by shutting down discussion of abortion and same-sex marriage.

The new leader says he will not formally reopen the debate on abortion, though he believes Parliamentarians have the right to speak out on all issues.

“The challenge now, and something I’ll be working very, very hard on, is to express our positions in a way that resonates with a larger (number) of Canadians,” he told reporters on Saturday.