BRUSSELS — Danish authorities Wednesday removed the final barrier to a natural gas pipeline between Russia and Germany that has drawn fire from President Trump, issuing a construction permit that could lead to the project’s completion within months.

The decision by the Danish Energy Agency to allow the Nord Stream 2 pipeline to be laid just outside Denmark’s waters — but inside Denmark’s exclusive economic zone — is a blow to U.S.-led efforts to halt the construction.

Critics have said that the project will increase European dependence on Russian energy at a time when the Kremlin and the West are at odds over a host of issues. Proponents of the pipeline, including the Russian and German governments, say it is simply a good business deal.

The vast majority of the 764-mile undersea pipeline has already been laid. Once completed, Nord Stream 2 will double the capacity of the original Nord Stream pipeline, which opened in 2011 and also caused consternation in Europe and the United States that Russia could use it to bypass Ukraine and cut gas off from Eastern Europe for political ends.

“We are pleased to have obtained Denmark’s consent,” Samira Kiefer Andersson, a Nord Stream 2 official, said in a statement. “We will continue the constructive cooperation with Danish authorities to complete the construction of the pipeline.”

U.S. authorities have threatened sanctions against companies that take part in the pipeline, although they have yet to follow through. The Trump administration wants to increase U.S. exports of liquefied natural gas to Europe, but opposition to the German-Russian project has been bipartisan, and many European countries have joined in the criticism. 

“It really makes Germany a hostage of Russia,” Trump said in June.

Critics also fear that the pipeline will allow Russia to shift gas transit away from Ukraine, depriving it of crucial revenue. 

The pipeline is entirely owned by the Russian energy company Gazprom, which is majority-owned by the government. Gazprom also owns 51 percent of the original Nord Stream pipeline. A consortium of European energy companies, including Shell, Wintershall, Uniper, OMV and Engie, is paying for half the construction cost.

Gazprom makes most of its profits from European gas exports, so the project will help finance the Kremlin’s bottom line. 

German Chancellor Angela Merkel sheltered the pipeline from European Union sanctions on Russia imposed in the years after the Kremlin’s 2014 annexation of Ukraine’s Crimean Peninsula.

Merkel has said that she would work to ensure that Ukraine is not cut off.

“The transit of gas through Ukraine must continue,” Steffen Seibert, a spokesman for Merkel, told reporters in Berlin on Wednesday.

Proponents of the project say it will increase Europe’s gas supply at a time when domestic supplies are shrinking. They say demand is sufficiently high that there will continue to be a need for gas transited through Ukraine, as well.

And since 2014, E.U. countries have taken steps to facilitate the reverse flow of natural gas to Ukraine when Russia cuts it off, mitigating some concerns about Russia’s ability to target individual countries with cutoffs in energy supply during geopolitical disputes.

Nord Stream 2 officials originally aimed to complete the project by the end of 2019, but they said this year that to do so would require the Danish permission to be granted by the end of summer. Construction can’t begin for at least a month from the time the permit is issued, to allow appeals to be filed.

The project will be finished in “the coming months,” Sebastian Sass, a senior adviser to the company, said Wednesday.

“The Danish Energy Agency has granted a permit to Nord Stream 2 AG to construct a section of the Nord Stream 2 natural gas pipelines on the Danish continental shelf southeast of Bornholm in the Baltic Sea,” the agency said in a statement.

Under international treaties, Denmark was obliged to issue the permit if it determined that the pipeline met environmental requirements. This year, Nord Stream 2 scrapped a different route that would have gone directly through Danish waters after the Danish Parliament passed a law to enable the government to reject projects in national waters if the Foreign Ministry determined they were geopolitically problematic. Danish leaders have opposed the project.

“It’s a purely administrative decision, which the sensitivity of this case shows. This is probably a good idea,” Dan Jorgensen, the minister for climate, energy and utilities, said in an interview in Copenhagen last month. “We have our hands off regulation on this.”

The route approved Wednesday is just outside Danish territorial waters, and a different set of rules applied. The pipeline will run adjacent to a former chemical weapons dumping ground in a region that is marked on official maps as “anchoring and fishing dangerous.” A different potential route would have gone through a densely trafficked shipping lane.

“It’s a technical evaluation,” Katja Scharmann, the chief adviser at the Danish Energy Agency, said ahead of the decision. “It’s not an easy task to say it’s the shipping lane or the chemical weapons grounds.”