OTTAWA — Canada’s Conservative Party on Saturday chose a 38-year-old social conservative and opponent of carbon taxes to lead its campaign against Prime Minister Justin Trudeau in the next election.

Andrew Scheer, an Ottawa native, was narrowly elected the party’s leader at its convention in suburban Toronto, winning 50.95 percent of the available points under the Conservatives’ complex voting system. He defeated Maxime Bernier, a free-market conservative from Quebec, after 13 rounds of ballot counting.

Mr. Scheer, who was first elected to Parliament at age 25, presented himself as a compromise candidate during his leadership campaign, which was mostly light on policy proposals. He suggested that under Stephen Harper, the former prime minister who stepped down as the party’s leader after Mr. Trudeau’s Liberals won the 2015 election, the Conservatives had been too negative in their approach to voters.

“I don’t like the fact Conservatives have that negative connotation — that we’re always against things, always ‘tackling’ something, ‘cracking down’ on something, or ‘getting tough’ on something else,” he told The National Post, a Toronto newspaper. “We have to have something positive to say on the flip side.”