OTTAWA — Officially, Canada is disappointed. But the Obama administration ’s decision on Friday to reject the Keystone XL pipeline, which would have linked Alberta’s oil sands to the Gulf of Mexico, also appeared to bring Canada’s new Liberal government a sense of relief.

The Conservative government that the Liberals, led by Prime Minister Justin Trudeau, replaced this week had made the approval of Keystone XL its top foreign policy priority, even though Canadians were divided over its importance.

During the campaign, Mr. Trudeau said he would push for Keystone XL. But it was a promise made with little obvious enthusiasm, probably an attempt, many observers said, to avoid rekindling Albertans’ memories of a controversial energy program introduced by his father, Pierre Elliott Trudeau, during his time as prime minister.

Now, Mr. Trudeau no longer has to keep his pipeline pledge, and he will be free to pursue a campaign promise he is enthusiastic about: improving Canada’s record on greenhouse gas emissions.