President Obama announced Friday that he has rejected Canadian energy giant TransCanada's application to build the Keystone XL pipeline, saying that the pipeline was not in the U.S. national interest.

"The State Department has decided the Keystone XL pipeline would not serve the interests of the United States. I agree with that decision," Obama said at a White House press conference.

The announcement caps a 7-year saga that has become one of the biggest environmental flashpoints of Obama’s presidency. It comes just days after the State Department refused to agree to TransCanada’s request to suspend the review process on the controversial project, which has seen enormous opposition from environmental groups.

Killing the pipeline allows Obama to claim aggressive action on the environment. That could strengthen his hand as world leaders prepare to finalize a major global climate pact next month in Paris that Obama hopes will be a crowning jewel for his legacy.

Alberta-based TransCanada first applied for Keystone permits in September 2008 -- shortly before Obama was elected. As envisioned, Keystone would snake from Canada's tar sands 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.

More On This...

Democrats and environmental groups latched onto Keystone as emblematic of the type of dirty fossil fuels that must be phased out. Environmentalists chained themselves to construction equipment and the White House fence in protest.

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.

Obama dismissed the claims that Keystone would be a major job creator.

“If Congress is serious about wanting to create jobs, this is not the way to do it,” he said, before calling for a bipartisan infrastructure plan that he says would make a more significant impact on job creation.

Republicans called the decision disappointing.

"President Obama's rejection of the Keystone XL Pipeline is a huge mistake, and is the latest reminder that this administration continues to prioritize the demands of radical environmentalists over America's energy security," said. Sen. Marco Rubio, R-Fla.

Former Pennsylvania Sen. Rick Santorum condemned the decision in a tweet.

“It [is] ironic that after delaying construction for more than seven years – postponing the jobs, revenues and other benefits that would result from the project – the president now finds it pressing to make a decision just as the company is asking for a pause to resolve any concerns," Sen. John Hoeven, R-N.D. said in a statement. 

Some Democrats, such as Sen. Barbara Boxer, D-Calif., praised the decision as a positive step in protecting the environment.

"I want to thank the Obama Administration for protecting the health of the American people and the health of the planet by rejecting the ill-advised Keystone tar sands pipeline, which would have brought the filthiest oil known to humankind into our country in large amounts,” Sen. Barbara Boxer, D-Calif., said.

Meanwhile 2016 hopeful Bernie Sanders called support for the pipeline "insane."

"It is insane for anyone to be supporting the excavation and transportation of some of the dirtiest fuel on earth. As someone who has led the opposition to the Keystone pipeline from Day 1, I strongly applaud the president’s decision to kill this project once and for all,” Sanders said.

Fox News’ Kevin Corke and The Associated Press contributed to this report.