The Obama administration has rejected TransCanada's application to build the Keystone XL pipeline, capping a seven-year saga that became an environmental flashpoint in both Canada and the U.S.

Speaking from the White House on Friday, Obama said Keystone "will not serve the national interests of the United States."

Obama said the State Department rejected the proposed pipeline, saying it would not make a meaningful long-term contribution to the U.S. economy.

The U.S. president said he has informed Canadian Prime Minister Justin Trudeau of the decision.

"While he expressed his disappointment, given Canada's position on this issue, we both agreed that our close friendship on a whole range of issues — including energy and climate change — should provide the basis for an even closer co-ordination between our countries going forward," Obama said.

Prime Minister Justin Trudeau said he was "disappointed" in the decision but that it will not hurt the strong ties between the two countries.

Despite the rejection, Calgary-based TransCanada's top executive said he continues to believe that a pipeline would eventually be built.

"TransCanada and its shippers remain absolutely committed to building this important energy infrastructure project," said Russ Girling, the company's president and chief executive officer. "We will review our options to potentially file a new application for border-crossing authority to ship our customer's crude oil, and will now analyze the stated rationale for the denial."

On the TSX, TransCanada shares were trading at $43.28, down about four per cent after the announcement was made at 11:45 a.m. eastern time.

Killing the pipeline allows Obama to claim aggressive action on the environment, potentially strengthening his hand as world leaders prepare to finalize major global climate pact within weeks that Obama hopes will be a crowning jewel for his legacy. Yet it also puts the president in a direct confrontation with Republicans and energy advocates that will almost surely spill over into the 2016 presidential election.

Court challenge expected

Although the project is a no-go for now, Obama's rejection will likely not be the last word for Keystone XL.

The pipeline's backers are expected to challenge his decision in court, and the Republican-controlled Congress may try to override the president, although those efforts have previously failed. The project could also get a fresh look in 2017 if a Republican wins the White House and invites TransCanada to reapply.

Another open question is whether the Calgary-based energy giant will try to recoup the more than $2 billion US it says it has already spent on the project's development. Earlier in the year, the company left the door open to suing the U.S. government under NAFTA.

"This is a day of celebration," said Bill McKibben of the environmental group 350.org. One of the pipeline's most vocal opponents, McKibben said the decision gives Obama "new stature as an environmental leader."

Energy groups immediately blasted the decision, arguing that Obama was discounting years of analysis by federal agencies that they said proved Keystone could be built to be safe and environmentally sound.

"This decision clearly flies in the face of volumes of scientific evidence that shows the Keystone XL pipeline would be safe, enhance environmental standards, and be a more cost-effective alternative to importing oil from overseas," said Michael Whatley of the Consumer Energy Alliance, which advocates for the energy industry.

The 1,900-kilometre proposed pipeline has been in limbo for more than seven years, awaiting a series of U.S. reviews that have dragged on more than five times longer than average, according to a recent Associated Press analysis. The pipeline requires a presidential permit to cross the U.S.-Canadian border.

Over time, the pipeline took on symbolic value of epic proportions, elevated by environmentalist and energy advocates alike into a proxy battle for climate change. Although Obama insisted both sides had overhyped the pipeline, his many delays only fuelled the mushrooming political controversy.

Obama forecast his reluctance to authorize the pipeline on Wednesday when his administration rejected TransCanada's unusual request to suspend — but not withdraw — its application. The White House suggested the move was aimed at delaying until Obama leaves office and is potentially replaced by a Republican, although TransCanada insisted that wasn't the case.

Seven-year odyssey

TransCanada first applied for Keystone permits in September 2008 — shortly before Obama was elected. As envisioned, Keystone would snake from Canada's oilsands through Montana, South Dakota and Nebraska, then connect with existing pipelines to carry more than 800,000 barrels of crude oil a day to specialized refineries along the Texas Gulf Coast.

Democrats and environmental groups latched onto Keystone as emblematic of the type of dirty fossil fuels that must be phased out. Opponents chained themselves to construction equipment and the White House fence in protest, arguing that building the pipeline would be antithetical to Obama's call for cutting greenhouse gas emissions.

But Republicans, Canadian politicians and the energy industry touted what they said were profound economic benefits — thousands of U.S. construction jobs and billions injected into the economy. They argued transporting crude by pipeline would be safer than alternatives like rail, and charged Obama with hypocrisy for complaining about the lack of investment in U.S. infrastructure while obstructing an $8 billion project.

Amid vote after vote in Congress to try to force Obama's hand, the president seemed content to delay further and further into the future.

For TransCanada, the financial imperative to build Keystone may have fallen off recently amid a sharp drop in oil prices that could make extracting and transporting the product much less lucrative. But TransCanada's CEO has insisted that isn't the case. When the company first proposed Keystone in 2008, oil was suffering an even bigger plunge and the global economy was collapsing.