WASHINGTON (AP) -- President Donald Trump greenlighted the long-delayed Keystone XL pipeline on Friday, declaring it a "great day for American jobs" and siding with energy advocates over environmental groups in a heated debate over climate change.

The presidential permit comes nearly a decade after Calgary-based TransCanada applied to build the $8 billion pipeline, which will snake from Canada through the United States. Trump's State Department said the project advances U.S. national interests, in a complete reversal of the conclusion President Barack Obama's administration reached less than a year-and-a-half ago.

"It's a great day for American jobs and a historic moment for North America and energy independence," Trump said, standing alongside TransCanada's CEO in the Oval Office. Keystone will reduce costs and reliance on foreign oil while creating thousands of jobs, he said, adding: "It's going to be an incredible pipeline."

The decision caps the long scientific and political fight over a project that became a proxy battle in the larger fight over global warming. And Friday's decision, while long foreshadowed by Trump's public support for Keystone, represents one of the biggest steps to date by his administration to prioritize economic development over environmental concerns.

TransCanada, Trump said, can now build Keystone "with efficiency and with speed." Though it still faces other major hurdles, including disputes over the route, the president said the federal government was formulating final details "as we speak."

The 1,700-mile (2,735 kilometers) pipeline, as envisioned, would carry oil from tar sands in Alberta, Canada, to refineries along the Texas Gulf Coast, passing through Montana, South Dakota, Nebraska, Kansas and Oklahoma. It would move roughly 800,000 barrels of oil per day.

Environmentalists, Native American groups and landowners who've opposed Keystone expressed outrage, and Greenpeace said the U.S. was "moving backwards" on climate and energy policy.

Story continues

"Keystone was stopped once before, and it will be stopped again," vowed Annie Leonard, the group's U.S. director.

Obama in 2015 rejected the pipeline after years of study, saying it would undercut U.S. credibility in the international climate change negotiations that culminated later that year in a global deal in Paris. He echoed the argument of environmental groups that Keystone would encourage use of carbon-heavy tar sands oil, contributing heavily to global warming.

Relying mostly on the same information, the Trump administration reversed Obama's decision Friday.

In a lengthy report, the State Department alluded to the Paris deal as one reason. Because many other countries have pledged to address climate change, it said Keystone can proceed without undermining the overall effort to slow global warming. The Paris agreement compels the U.S. and other countries to cut greenhouse gas emissions in coming decades.

Keystone would strengthen U.S. energy security by increasing access to Canada's "dependable supply of crude oil," said the State Department, which had jurisdiction because the pipeline crosses the U.S.-Canada border.

But the level of those benefits has been the subject of exhaustive debate in recent years.

Obama argued the oil wouldn't stay in the U.S. because it would be exported after being processed in American refineries. TransCanada insisted Keystone "is not an export pipeline." Many energy experts insisted the truth was somewhere in between.

Environmental groups argued Canada's tar sands oil should stay in the ground. But Keystone's backers said that wouldn't happen even if the pipeline wasn't built. Without a pipeline, they said the oil would move by rail or truck, more dangerous methods which themselves contribute greenhouse gas emissions.

How many jobs Keystone will create is also widely disputed.

TransCanada promised as many as 13,000 construction jobs and Trump once predicted it "could be 42,000 jobs." The vast majority would be "indirect" jobs other industries gain from the influx of dollars and construction workers. Other estimates predict just a few thousand jobs, lasting only for the few years the pipeline is being built. And after that, only a few dozen workers would be needed to maintain the pipeline.

TransCanada CEO Russ Girling said Friday that thousands of people are "ready and itching to get to work."

Trump boasted as recently as this week that Keystone would be built with American steel, which he has required for new or expanded pipelines. But his administration has already given Keystone a pass. TransCanada has already acquired the steel for the project, and the White House has said it's too difficult to impose Trump's requirement on a project already under construction.

Although portions of Keystone are already built, it still faces obstacles to completion. In Nebraska, for example, the route must still be approved and opponents have repeatedly thwarted TransCanada's attempts to access the necessary land. A commission is expected to review the matter later this year.

Trump, told of the hiccup, pledged his help.

"Nebraska? I'll call Nebraska," he said.

___

Associated Press writers Jill Colvin in Washington, Rob Gillies in Toronto and Grant Schulte in Lincoln, Nebraska, contributed to this report.

___

Reach Josh Lederman on Twitter at http://twitter.com/joshledermanAP