President Obama, denouncing a “rushed and arbitrary deadline” set by congressional Republicans, announced Wednesday that he was rejecting a Canadian firm’s application for a permit to build and operate the Keystone XL pipeline, a massive project that would have stretched from Canada’s oil sands to refineries in Texas.

Obama said that the Feb. 21 deadline, set by Congress as part of the two-month payroll tax cut extension, made it impossible to adequately review the project proposed by TransCanada. But he left the door open to the possibility that a new proposal might pass regulatory muster.

“This announcement is not a judgment on the merits of the pipeline, but the arbitrary nature of a deadline that prevented the State Department from gathering the information necessary to approve the project and protect the American people,” the president said in a statement.

This is the second time the Obama administration has tried to deflect political pressure over the proposed $7 billion, 1,700-mile Keystone XL pipeline, which last year sparked debate over U.S. energy and environmental policy. At one point, about 12,000 people demonstrated outside the White House against the project, while the oil industry, construction unions and the Canadian government lobbied in favor of it.

The decision Wednesday and the language Obama used made clear that the White House, far from pushing off the issue until after the election, as it once hoped to do, was fully engaged in a battle with pipeline proponents. The president defended his administration’s record on energy security while pledging to protect the “health and safety” of Americans.

While the current Keystone XL permit application is dead, the pipeline might not be. The administration will allow TransCanada to reapply for a permit after it develops an alternate route around the Nebraska Sandhills, a sensitive habitat.

TransCanada’s chief executive, Russ Girling, issued a statement saying that the company will reapply and that he expects that “a new application would be processed in an expedited manner” so the pipeline could be carrying crude by late 2014. “While we are disappointed, TransCanada remains fully committed to the construction of Keystone XL,” he said.

Kerri-Ann Jones, the State Department’s assistant secretary in the bureau of oceans and international environmental and scientific affairs, said that while “we would be able to draw on the information that’s out there,” if TransCanada files “a new application, it will trigger a new process.”

The administration’s move did nothing to delay a debate that could help define the campaign fight between Republicans and Democrats. Environmental groups have lobbied against the project, arguing that the extraction of oil sands — a process more akin to strip-mining than drilling — is so energy-intensive that it contributes to climate change. They also assert that the pipeline could leak, possibly endangering the giant Ogallala Aquifer, which provides drinking and irrigation water to much of the Great Plains.

Supporters of the pipeline say it would create jobs and enhance U.S. energy security by increasing reliance on a friendly neighbor. Canada, the largest source of U.S. crude oil imports, already exports oil to the United States from the Alberta oil sands through other pipelines. The Keystone XL, able to carry about 500,000 barrels a day, would enable Canada to raise its output.

The permit denial could complicate Obama’s already difficult task of winning support in Congress for his agenda this year.

“This is not the end of the fight,” House Speaker John A. Boehner (R-Ohio) said at a news conference. “Republicans in Congress will continue to push this because it’s good for our country, and it’s good for our economy, and it’s good for the American people, especially those who are looking for work.”

The House Energy and Commerce Committee said it will hold a hearing next Wednesday, inviting Secretary of State Hillary Rodham Clinton to explain the decision.

Leading congressional Democrats, however, rallied around the president. Rep. Henry A. Waxman (Calif.) said, “Today, the Obama administration rejected a dirty and dangerous tar sands oil pipeline, refusing to be bullied by the oil industry.”

Rep. Peter Welch (D-Vt.) said, “The Republicans are using, and will never stop using, Keystone as a political talking point,” adding that the administration, “to its credit . . . decided it will wage that battle during the campaign.”

The GOP presidential candidates wasted no time. Even before the formal announcement, front-runner Mitt Romney issued a statement accusing Obama of putting “politics ahead of sound policy.”

“He seems to have confused the national interest with his own interest in pleasing the environmentalists in his political base,” Romney said.

Former House speaker Newt Gingrich (Ga.) called Obama’s decision “stupid,” saying it will cost thousands of construction jobs, jeopardize energy security and undermine the country’s international alliances.

“This is really bad for the country,” Gingrich said, adding that the decision was made “to appease a group of left-wing extremists sitting in San Francisco.”

The pipeline, which requires a federal permit from the State Department because it crosses an international border, had been under review for more than three years. The department is required to determine whether the project is in the national interest.

In November, the administration delayed making that determination, on the grounds that the project needed to avoid crossing sensitive terrain in Nebraska’s Sand­hills region.

At the time, officials predicted that rerouting the pipeline and the subsequent environmental review would extend the permitting process into early 2013.

Some political observers said the effort by Congress to pressure the president into making a quick decision might have backfired. Last week, John Engler, a former Michigan governor who now heads the Business Roundtable, said that “no chief executive likes to be painted into a corner by anybody, whether another nation or a legislative body.” Engler and the Business Roundtable support the pipeline project.

Sierra Club Executive Director Michael Brune said in a phone interview that the White House is sending a strong message to voters in rejecting the pipeline, demonstrating Obama’s “enduring commitment to breaking our dependence on oil.”

Republicans and their allies are just as eager to make the pipeline a decisive issue in the presidential election. U.S. Chamber of Commerce President Thomas J. Donohue issued a statement Wednesday saying, “This political decision offers hard evidence that creating jobs is not a high priority for this administration.”

The jobs issue has been a major point of contention. Ads taken out by pipeline supporters routinely say the project would create 20,000 jobs. But TransCanada’s Girling has said that Keystone XL would create 20,000 “job-years” — including 13,000 for direct construction and 7,000 for supply manufacturers. Construction would last two years, and the number of construction workers employed each year would total 6,500, Girling has said.

Moreover, TransCanada has already spent $1.9 billion buying pipeline parts, reducing the number of supply-chain jobs that could be created in the future.

Nonetheless, James T. Callahan, president of the International Union of Operating Engineers, called Obama’s decision “a blow to America’s construction workers” in “the sector hardest hit by the recession.”

Obama tried to defuse one criticism on Wednesday by saying his administration will explore ways to relieve the pipeline bottleneck that is slowing oil shipments between a major terminal in Cushing, Okla., and the nation’s Gulf Coast refineries.Oil produced in Montana and North Dakota is being taken by truck and train to refineries.

The American Petroleum Institute has been waging a no-holds-barred television ad campaign hammering Obama on the pipeline permit. During the week of Jan. 9, the API spent $605,510 on ads in six states and the District, according to CMAG/Kantar Media. The largest amounts were spent in crucial electoral battlegrounds in the Midwest, including Illinois, Michigan and Ohio.

API President Jack Gerard said Wednesday that Obama’s decision was “a clear abdication of presidential leadership.”

But Stephen Brown, vice president of federal government affairs for the oil refiner Tesoro, said he was not surprised. “Today’s decision will be a fairly easy one for the White House to make,” he wrote in an e-mail. “No one who was planning on voting against the president would have been won over simply because of the approval of Keystone.”Engler said, “I just think the timing was such that the politics got in the way of the decision and that it will be approved pretty quickly once the elections are out of the way.”

Staff writers David Nakamura, Karen Tumulty, David A. Fahrenthold and T.W. Farnam contributed to this report.