WASHINGTON (AP) — Defying a presidential veto threat, the Republican-controlled U.S. Senate approved a bipartisan bill to construct the Keystone XL pipeline to Canada's tar sands, setting up another battle with the White House over energy and the environment.

The 62-36 vote Thursday advanced a top priority of the newly empowered Republicans, 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 two-thirds to override a presidential veto in the 100-member chamber and the legislation still must be reconciled with the version the House of Representatives passed.

First proposed in 2008, the $8 billion pipeline project has been beset by delays in the state of 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.

The pipeline would connect with existing pipelines to carry more than 800,000 barrels of crude oil a day to refineries along the Texas Gulf coast.

Republican Senate Majority Leader Mitch McConnell said the bill "is an important accomplishment for the country," said. "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."

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.

In Philadelphia, anti-pipeline protesters chanted outside a hotel where Obama was addressing a retreat of Democratic lawmakers: "Hey, Obama, we don't want no Keystone drama."

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.