WHEN Stephen Harper stepped down as leader of Canada’s Conservative Party after losing a national election in October 2015, it looked as if the party he had created might come apart. That 13 candidates came forward to succeed him was an indication of how many ideologies he had knitted together. Among them were three anti-abortion social conservatives, a libertarian and a Trumpian populist. Any one of these might have unravelled Mr Harper’s coalition.

In an election on May 27th to choose his successor, the 140,000 party members who voted stayed with what they knew. Andrew Scheer, a genial, 38-year-old father of five from the western province of Saskatchewan, spent his 13-year political career under the leadership of Mr Harper, who was prime minister for nearly ten years. Mr Scheer shares his predecessor’s enthusiasm for smaller government and lower taxes. Like Mr Harper he opposes carbon taxes and emphasises the need to go after “radical Islamic terrorists”. The media dubbed him “Harper lite”. He prefers “Harper 2.0”. Now Justin Trudeau, the Liberal who defeated Mr Harper to become prime minister, will face a duly elected leader of the opposition for the first time.

The race was close. Mr Scheer won 50.95% of the vote after 13 rounds of counting. (About half the party’s members voted, listing candidates in their order of preference; those who backed the least popular candidates in each round had their next preferences counted.) Maxime Bernier, a libertarian from Quebec who promised to dismantle protection for dairy farmers, remained in first place until the final round. Farmers from his own riding in Quebec organised against him.

Mr Scheer was a popular second choice. At the party’s convention in Toronto, where a few thousand members voted, his team cannily asked them to “mark Andrew as number one or number two on your ballot”. Social conservatives helped him win, although he has promised not to support legislation on issues such as abortion that would divide the Conservative caucus.

In choosing Mr Scheer, the Conservatives shunned both Mr Bernier’s libertarianism and the populism of Kellie Leitch, who got a lot of attention by suggesting that immigrants and visitors be tested for “Canadian values”. She received just 7% of first-round votes.

Despite his relative youth, Mr Scheer is a seasoned career politician, having served as Speaker of the House of Commons. Like Mr Trudeau, he is fluent in French, the language of Quebec. But he may not solve the problems revealed by the Conservatives’ defeat in 2015. The biggest is that the party appeals to ageing baby-boomers and their parents, but not to their children.

The generation gap is apparent on such issues as climate change. Conservatives from western, energy-producing provinces, like Mr Scheer and Mr Harper, tend to oppose costly action to reduce emissions of greenhouse gases. Mr Scheer promised in his victory speech to repeal the “job-killing carbon tax” that the Liberal government plans to impose on provinces that do not put a price on carbon. Michael Chong, the one candidate for the leadership to support a carbon tax, was booed for this during a pre-election debate. Alex Kwong, a young Conservative delegate from Toronto, lamented that in rejecting such measures the party was distancing itself from millennial voters. Progressive Conservatives, one of the tendencies Mr Harper brought into his big-tent party, had made the environment “our issue”, he said. The Liberals “took it away from us”.

Mr Scheer’s supporters are counting on his charm to infuse Harperism with new life. “Justin Trudeau is a likeable kind of guy, and we need somebody who has a good personality,” said Katherine Federkiewicz, a Conservative delegate at the Toronto convention. Mr Scheer has more than two years to woo Canadians: the next election is in October 2019. He will need that time. A recent poll by Nanos shows support for the Conservatives at 29%—11 points behind the Liberals. Mr Scheer will have to smile a lot to overcome that.