WASHINGTON — The political ground may be shifting under the Keystone XL pipeline.

Just weeks ago, the smart money in Washington had President Obama approving the cross-border oil pipeline later this year, perhaps balanced with a package of unrelated climate change measures. The seemingly inevitable decision would leave the pipeline’s opponents — a group that includes a large number of Mr. Obama’s most ardent supporters and generous donors — dispirited and disillusioned by what one called the president’s half-a-loaf centrism.

But Mr. Obama threw that calculation into doubt last week when he unexpectedly added a brief passage on the pipeline project to a major address laying out his second-term climate change agenda. Mr. Obama said he would approve the remaining portion of the 1,700-mile pipeline from Alberta to Gulf Coast refineries only if it would not “significantly exacerbate” the problem of carbon pollution. He added that the pipeline’s net effects on the climate would be “absolutely critical” to his decision whether to allow it to proceed.

The president had never before attached such explicit climate-related conditions to the fate of the project.

The project’s opponents were thrilled, saying the president had finally recognized the threat to the global climate posed by the pipeline and the accompanying expansion of Canadian oil sands development. They also crowed that citizen activism and vocal opposition by many of the president’s strongest supporters had altered the political calculus.