WASHINGTON (AP) — The Republican-controlled Senate on Thursday approved a bipartisan bill to construct the Keystone XL oil pipeline, defying a presidential veto threat and setting up the first of many battles with the White House over energy and the environment.

The 62-36 vote advanced a top priority of the newly empowered GOP, and marked the first time the Senate passed a bill authorizing the pipeline, despite numerous attempts to force President Barack Obama’s hand on the issue. Nine Democrats joined with 53 Republicans to back the measure.

Still the vote was short of the threshold needed to override a veto, and the legislation still must be reconciled with the version the House passed.

This bill “is an important accomplishment for the country,” said Majority Leader Mitch McConnell of Kentucky. “We are hoping the president upon reflection will agree to sign on to a bill that the State Department said could create up to 42,000 jobs and the State Department said creates little to no impact on the environment.”

Democrats framed the bill as gift to a foreign oil company that would have little benefit for the American people, because much of the oil would be exported. They tried and failed to get amendments on the bill to construct the pipeline with U.S. steel, ban exports of the oil and the products refined from it, and protect water resources.

The Senate agreed to add an energy efficiency measure, and went on the record saying climate change was not a hoax and the oil sands should be subject to a tax that helps pay for oil spill cleanups. Oil sands are currently exempt.

“This bill is a disgrace,” said Sen. Barbara Boxer, the top Democrat on the Senate environment committee. “We tried on our side to make this a better bill and they turned us away.”

First proposed in 2008, the $8 billion pipeline project has been beset by delays in Nebraska over its route and at the White House, where the president has resisted prior efforts by Congress to force him to make a decision. In 2012, Obama rejected the project after Congress attached a measure to a payroll tax cut extension that gave him a deadline to make a decision. The pipeline’s developer, TransCanada Corp., then reapplied.

Obama has said he will not be forced to make a decision on the pipeline, which requires presidential approval because it crosses an international border, until the review process concludes. Federal agencies’ comments on whether the project is in the national interest are due Monday.

Environmental groups have called on Obama to reject the project outright, saying it would make it easier to tap a dirty source of energy that would exacerbate global warming. The State Department’s analysis, assuming higher oil prices, found that shipping it by pipelines to rail or tankers would be worse for the planet.

Supporters say the pipeline is a critical piece of infrastructure that will create thousands of jobs during construction and boost energy security by importing oil from a friendly neighbor.

Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.