The U.S. Senate dealt a setback Tuesday to the re-election campaign of Sen. Mary Landrieu by narrowly rejecting a Keystone XL pipeline bill.

With Landrieu, D-La., as the prompter, the issue had moved to center stage in the early days of Congress’ lame-duck session — and emerged as a lead player in a political drama co-starring Landrieu and her Republican opponent in the Dec. 6 runoff election, U.S. Rep. Bill Cassidy, of Baton Rouge.

The Senate had 41 votes against the measure, which was identical to a Cassidy-sponsored bill the House passed on Friday. The bill needed 60 votes to pass the Senate. It received 59. The legislation would have directed President Barack Obama to approve completion of the oil pipeline.

“This is about energy independence,” Landrieu said in the six-hour debate on the bill. “This is about jobs.

“This can be done — and North America can be the super energy powerhouse of the planet.”

But Sen. Patrick Leahy, D-Vt., said, “This pipeline is part of the unquenchable thirst for oil that is destroying our environment.”

Landrieu lobbied hard for passage of the bill with her fellow Democrats in the Senate, in what appeared to be an effort to somehow shake up the dynamic of the Dec. 6 runoff. Opinion polls show Cassidy headed for victory on the crest of a strong Republican wave.

In response to the vote, the Cassidy campaign faulted what it called Landrieu’s inability to represent Louisiana effectively in the Senate. Should Cassidy defeat Landrieu, his campaign said, he will join the Republican majority in the incoming Senate to pass a Keystone bill. “If there was ever legislation that should be enthusiastically approved by President Obama and his supporters in the Senate, it should be the Keystone XL pipeline,” Cassidy said in a prepared statement.

The 45 Senate Republicans voted for the bill, joined by Landrieu and 13 other Democrats.

“It’s been quite a few exciting days on the floor of the Senate,” Landrieu said after the vote, regarding her failure to find one more Democrat to side with her.

“There’s no blame,” she said. “There’s only joy in the fight.”

Despite the outcome, Landrieu may claim credit for pushing a Keystone measure to the Senate floor. And Cassidy likely will point out that he got his version through the House, which had approved similar proposals eight times before.

Opinion polls have shown majority popular support in Louisiana and across the country for the pipeline, which would bring “dirty” tar-sands oil from Canada to refineries on the Texas Gulf Coast. Supporters of the pipeline say it would create jobs and reduce American dependence on oil imported from unfriendly and unstable foreign countries outside North America. Opponents fear it would result in oil spills and increased carbon emissions. The project has been stalled for years by Obama, whose approval is required because the pipeline crosses an international border.

What might look like a rare case of collaboration among political opponents — Cassidy and Landrieu — actually amounts to a battle for Keystone bragging rights.

Cassidy, a third-term House member from Baton Rouge who ran a close second to Landrieu in Louisiana’s open primary Nov. 4, introduced his version of the Senate Keystone bill this week. The ruling House Republican leadership rushed it through the approval process. Similar House-passed measures have languished in the Democratic-majority Senate.

In her campaign against Cassidy, Landrieu, a three-term incumbent, has touted the influence she has gained in the Senate by virtue of her seniority — in particular, her appointment early this year as chairwoman of the Energy and Natural Resources Committee, with its oversight of the oil and gas industry central to the Louisiana economy. Landrieu is a longtime friend of the industry.

The Democrats’ election defeats in other states Nov. 4 mean they will lose the Senate majority in the new Congress convening in January, and with it, the power to determine the energy committee chairman. Landrieu still would like to show she can get things done for her state, and the Keystone bill was a chance to do that. In the process, she could demonstrate her independence from Obama.

Cassidy has focused his campaign on linking Landrieu to the president, who is widely unpopular in Louisiana. Cassidy and a tea party Republican, Rob Maness, combined for 55 percent of the Nov. 4 primary vote total. With no single candidate winning a majority in the primary, the top two finishers advanced to the runoff.

Obama has said that before he decides on the pipeline, he wants to wait for completion of a State Department review and for resolution of a legal challenge to the pipeline’s route now before the Nebraska Supreme Court.

Landrieu sponsored a Keystone bill that she moved through the energy committee in June. But that bill has not come up for a floor vote due to partisan wrangling and objections from a majority of the Democrats who currently rule the Senate.

When the Senate returned to the capital Wednesday after the Nov. 4 elections, Landrieu took to the floor to press for a vote on a similar Keystone bill by John Hoeven, R-N.D. This time, the Senate Democratic leadership acquiesced — and under the Senate rules for the legislation, 60 votes were required to pass the bill. The movement in the Senate spurred Cassidy into action in the House.

Follow Gregory Roberts of The Advocate Washington bureau on Twitter, @GregRobertsDC.