NEW YORK (Reuters) - Oil prices surged on Thursday after a raging wildfire near Canada’s oil sands region curbed output that mainly flows to the United States, before settling off their highs as a rebounding dollar and a huge U.S. stockpile build cut into gains.

Slideshow ( 2 images )

While the oil sands facilities are mostly to the north of the wildfire in city of Fort McMurray in Alberta that is spreading south, as much as a third of Canada’s daily crude capacity has been cut and some major pipelines closed after more evacuations were ordered.

A stranded Glencore oil cargo in Libya, after a stand-off between eastern and western political factions, also fed the rally at first.

Some traders said the market had overreacted to both events.

“The Canadian blaze, horrific as it is, is far south of the real producing fields to cause real lasting damage to production there,” said John Kilduff, partner at New York energy hedge fund Again Capital. “The Libyan barrels weren’t really on the market anyway.”

Crude oil futures jumped 5 percent before paring gains. Their retreat came as the dollar rose 0.6 percent, its most in three weeks, making greenback-denominated oil costlier for holders of the euro and other currencies.

Some traders also pinned oil’s weakening to market intelligence firm Genscape’s report of a 1.35 million-barrels stockpile build at the Cushing, Oklahoma delivery hub for U.S. crude futures during the week to May 3. The Genscape report came on the heels of U.S. government data showing total crude stockpiles at record highs above 543 million barrels last week.

Brent futures settled up 39 cents, or 0.9 percent, at $45.01 a barrel.

U.S. crude’s West Texas Intermediate (WTI) futures rose 54 cents, or 1.2 percent, to settle at $44.32.

Earlier this week, oil lost its almost unbroken upward momentum since April’s gain of more 20 percent that gave Brent its best monthly gain in seven years. Over Monday and Tuesday, crude prices fell 6 percent as major producers in and outside OPEC pumped at or near record highs.

Even so, some analysts said the fallout from the Canadian inferno was being underestimated.

At least 640,000 barrels per day (bpd) of capacity was offline, according to Reuters’ calculations.

“The situation is clearly very serious,” said London-based PVM, which notes that of the 4.5 million bpd that Canada produces, 3.4 million goes to the United States.

On Friday, traders will be on the lookout for U.S. jobs data for April, to indicate the likelihood of a rate hike by June that will further bolster the dollar.