By Timothy Gardner

WASHINGTON (Reuters) - The payroll tax bill passed by Congress contains a provision forcing President Barack Obama to speed his decision on the Keystone XL oil pipeline, but his approval is far from certain.

The bill, which passed on Friday, said Obama must grant a permit for TransCanada Corp's Canada to Texas pipeline in 60 days, unless he determines the line does not serve the national interest.

"The project now faces further uncertainty following its entanglement in Congressional maneuvering around the payroll tax extension legislation," Robert Johnston, a director for energy and natural resources at the Eurasia Group, said in a research note.

Obama bowed to huge pressure from environmentalists, who staged high-profile protests to stop the pipeline that would deliver oil sands crude from the boreal forests of Alberta to refineries in Texas.

In November the State Department, which has the power to give the project a final permit because it would cross the state border, announced it would delay its decision until after next year's presidential election.

Environmentalists oppose the project for the carbon emissions that come from processing oil sands. But the line also faced stiff opposition in Nebraska because of concerns a pipeline spill would contaminate a huge aquifer that serves millions or spoil its fragile Sandhills region.

Despite the language in the bill, Obama still has the ability to delay the project. He could reject it based on the national interest argument or he could give it a thumbs up but delay it by awaiting a route study.

If Obama decides the pipeline is not in the national interest, "it would effectively be the end of the project," said Johnston, although TransCanada would likely still move forward with a smaller leg of the pipeline from the Cushing, Oklahoma oil hub to Texas.

But even if Obama approves it within 60 days, he could do so conditionally by declaring the project is in the national interest, but contingent on the completion of the State Department's study on alternative routes through Nebraska.

The State Department delayed its decision because it said it needed to do additional analysis on the line's routes in Nebraska, to avoid environmental damage.

That decision came a day after some 10,000 environmentalists and other opponents of Keystone circled the White House in protest of the pipeline.

White House officials have also said the congressional maneuvering does not help the project. Dan Pfeiffer, a White House communications director, tweeted before the Senate passed its version of the payroll tax bill last week: "How will (Republicans) explain to their members that the bill doesn't force the President to approve Keystone, it essentially kills it?"

Daniel Weiss, of the Center for American Progress, said last week that even if Obama approves the line, it would not survive the court process, as U.S. law clearly states that environmental impact statements have to be fully completed before the government can determine whether a project is in the national interest.

If Obama kills the project, Republicans would likely try to use that against him in the campaign, particularly if oil prices rise next summer, and as the jobless rate remains stubbornly high.

Supporters say the pipeline would create 20,000 jobs, but the State Department has said the number is closer to 7,000.

(Editing by Russell Blinch and Bob Burgdorfer)

(Reporting By Timothy Gardner)