TransCanada, the Calgary-based company that first applied for a presidential permit in 2008, called the decision a “significant milestone.”

The Trump administration issued a permit on Friday to build the Keystone XL pipeline, reversing the conclusion of the Obama administration and clearing the way for the $8 billion project to finally be completed.

The State Department, responsible for reviewing the project because it crosses an international border, determined that building it serves U.S. national interests. That conclusion followed a review of environmental, economic and diplomatic factors, the department said.

It wasn’t immediately clear what, if anything, had changed since the State Department reached the opposite conclusion two years ago. President Donald Trump planned to address Keystone during an announcement on Friday morning, White House spokesman Sean Spicer said on Twitter.

TransCanada, the Calgary-based company that first applied for a presidential permit in 2008, called the decision a “significant milestone.”

“We greatly appreciate President Trump’s administration for reviewing and approving this important initiative,” said TransCanada CEO Russ Girling. “We look forward to working with them as we continue to invest in and strengthen North America’s energy infrastructure.”

The 1,700-mile 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. The pipeline would move roughly 800,000 barrels of oil per day, more than one-fifth of the oil Canada exports to the U.S.

Yet even with a presidential permit, the pipeline still faces obstacles most notably the route, which is still being heavily litigated in the states. Native American tribes and landowners have joined environmental groups in opposing the pipeline.

TransCanada said on Friday it would continue engaging with “neighbors throughout Nebraska, Montana and South Dakota to obtain the necessary permits and approvals to advance this project to construction.”

In an unusual twist, the presidential permit was signed by Tom Shannon, a career diplomat serving in a senior State Department role, rather than by Secretary of State Rex Tillerson. The former CEO of oil company Exxon Mobil recused himself after protests from environmental groups who said it would be a conflict of interest for Mr. Tillerson to decide the pipeline’s fate.

Oil industry advocates say the pipeline will improve U.S. energy security and create jobs, although how many is widely disputed. Calgary—based TransCanada has promised as many as 13,000 construction jobs 6,500 a year over two years but the State Department previously estimated a far smaller number. The pipeline’s opponents contend the jobs will be minimal and short-lived, and say the pipeline won’t help the U.S. with energy needs because the oil is destined for export.

President Donald Trump has championed the pipeline and backed the idea that it will prove a job creator. In one of his first acts as president, he invited pipeline company TransCanada to resubmit the application to construct and operate the pipeline. And he had given officials until next Monday to complete a review of the project.

A Trump presidential directive also required new or expanded pipelines to be built with American steel “to the maximum extent possible.” However, TransCanada has said Keystone won’t be built with U.S. steel. The company has already acquired the steel, much of it from Canada and Mexico, and the White House has acknowledged it’s too difficult to impose conditions on a pipeline already under construction.

Portions of Keystone have already been built. Completing it required a permit to cross from Canada into the U.S.

Environmental groups also say the pipeline will encourage the use of carbon-heavy tar sands oil which contributes more to global warming than cleaner sources of energy. President Barack Obama reached the same conclusion in 2015 after a negative recommendation from then-Secretary of State John Kerry.

TransCanada first applied for a permit in 2008. Years of politicking, legal wrangling and disputes over the pipeline’s route preceded Mr. Obama’s decision to nix the project. The various delays meant Hillary Clinton never issued a recommendation during her four years as secretary of state.

In rejecting Keystone, the Obama administration argued it would undercut U.S. efforts to clinch a global climate change deal that was reached weeks later in Paris. Mr. Kerry’s recommendation against the permit came after lengthy State Department reviews, and it was unclear what justification the agency might now use to explain the change of position.

The Trump administration has dropped fighting climate change as a priority and left open the possibility of pulling out of the Paris deal.