SAN FRANCISCO (MarketWatch) -- Crude-oil futures closed lower Wednesday after Iranian President Mahmoud Ahmadinejad said he would release 15 U.K. Navy personnel being held captive by Tehran, apparently ending a diplomatic crisis that had raised investor concerns about oil supplies in the region. The sailors boarded a British Airways flight from Tehran to London early Thursday, according to Associated Press.

But oil's loss was modest, capped by gains in gasoline futures, which climbed by more than 4% to close at a seven-month high after the U.S. Energy Department reported that supplies of the motor fuel dropped for an eighth week in a row.

Crude for May delivery finished down 26 cents at $64.38 a barrel on the New York Mercantile Exchange, recovering a bit from the pre-supply data release low of $63.60 -- its weakest intraday level since March 27. The contract lost 2% of its value on Tuesday as traders began to unwind the risk premium built into prices during the crisis.

"As tensions ease, it is not surprising to see some of the risk premium leak from prices," said Michael Fitzpatrick, an analyst at Fimat USA.

"But the Iranian nuclear situation hasn't been unwound so there is still plenty to worry about, which is why we are inclined to think the market has a very limited downside scope," he said in a note to clients.

May crude traded at $61.69 on March 22, the day before Iran's arrest of the British troops. The contract peaked at a close of $65.94 on Monday -- a 6.8% gain.

"Neither side was ever likely to do anything to interrupt the flow of oil from Iran," said James Williams, an economist at WTRG Economics.

"All that you need to do in to understand the situation is pretend you are the president of Iran. -- if you stopped exporting your 2.5 million barrels per day of crude oil, you would lose about $150 million per day in revenue or $4.5 billion a month," he explained in e-mailed comments. "That is 30% of the country's GDP and puts it into an economic depression that makes the Great Depression look weak."

And then pretend "you are the president of the U.S. and attacked or blockaded Iranian oil shipments," he said. "Even if all other oil from the Saudis, Kuwait, Iraq and UAE could get out of the Gulf. That would drive prices to $100 and certainly lead to a U.S. recession just a year or so before the next elections."

Oil prices had "climbed anyway because futures markets move on perceptions. This happens whether or not the perception coincides with the reality," Williams said. Read a related Commodities Corner.

Gasoline props up oil

At the same time, "the gasoline market has been hit hard by record gasoline demand during a time of dropping gasoline production," said Phil Flynn, a senior analyst at Alaron Trading, in e-mailed commentary. "Gas production in the U.S. has been well below average with refineries suffering through a very tough refinery maintenance season."

"The drop in gasoline stocks might have even supported crude had it not been for the announcement that the British captives were to be freed," said Williams.

May reformulated gasoline climbed by 4.4%, or 8.77 cents, to end the session at $2.1054 a gallon. It had traded as low as $2.006 before the supply data were released and traded as high as $2.11 afterward -- the contract's strongest level since Sept. 1.

May heating oil closed at $1.8644 a gallon, up 2.57 cents.

Motor gasoline supplies dropped 5 million barrels for the week ended March 30, the Energy Department reported Wednesday. It pegged total supplies at 205.2 million barrels, or 2.6% below the level from a year ago.

Gasoline supplies have now fallen a total of 22 million barrels since the week ended Jan. 26, according to the government data.

In contrast, the American Petroleum Institute, which has a different method of collecting its data, reported that gasoline supplies fell 440,000 barrels to total 202 million for last week.

"As soon as we see a good stock build in gasoline it could easily lead to a 25-cent drop -- which would probably influence crude as well," said Williams.

The average price for a gallon of regular gasoline has been climbing. It last stood at $2.70, up 8.8% from a month ago, according to AAA's Fuel Gauge Report.

Refinery utilization was unchanged at 87% of capacity, according to the Energy Department Wednesday.

Crude-oil imports were up 613,000 barrels per day last week vs. the previous week to average more than 10.2 million barrels per day, the government data showed.

Total product supplies over the last four-week period averaged almost 21 million barrels per day, up 1.4% from the same time a year ago. Of that, motor-gasoline demand was up 1.7% from the year-ago period to average almost 9.3 million barrels per day, and distillate-fuel demand averaged almost 4.4 million barrels per day, down 1.9% from the same time a year ago, the data showed.

Meanwhile, crude supplies rose more than expected, up 4.3 million at 332.7 million, according to the Energy Department. They're still 2.8% below the year-ago level.

The API posted a decline of 104,000 barrels to 335.2 million.

And distillate supplies, which include heating oil and diesel fuel, were unchanged at 118 million barrels in the latest week, the Energy Department said. The inventories, which had dropped nearly 25 million barrels over the last nine weeks, stood 2.6% below the year-ago level, the data showed.

The API said distillates climbed 455,000 barrels to total 119.7 million last week.

Iran softens stance

Iran's Ahmadinejad used a news conference for the Persian New Year to announce that the British sailors would be released, easing concerns about supplies. The announcement was not a major surprise; the U.K. government had said earlier it believed that Iran would like an "early resolution" to the crisis.

The 15 sailors were seized by armed Iranian forces 13 days ago and charged with trespassing in Iranian waters. The U.K. had insisted they were in Iraqi waters, patrolling under a United Nations mandate when they were captured.

Traders said the sudden resolution of the Iranian crisis and release of the British captives could cause a sharp selloff in the energy market, given the speed with which prices surged last week as the crisis unfolded.

But supply and demand fundamentals also point toward lower oil prices in the medium-term, as global oil markets are moving toward excess capacity, Royal Bank of Scotland economists said Wednesday.

Crude prices have risen by about 35% since their January low below $50 a barrel, said RBS economist Thorsten Fischer. That's a "stark reminder of the short-term volatility of oil prices due to the imbedded risk premium," he said in a note to clients.

"Excess capacity will make it easier for oil-consuming countries to find alternative sources of oil in the event of supply disruptions," he said. "It also makes it more tempting for OPEC members to cheat, that is, to produce above their allocated quotas, resulting in upward pressure on supply. Both factors tend to reduce oil prices."

At the same time, "the market will still factor in remaining political tension about the U.S. in Iraq," said Anthony Sabino, a professor of law at St. John's University, whose practice includes oil and gas law.

And it'll really focus in on "the coming of the summer driving season in the U.S., which will raise prices yet again, and weather news about an expected harsh hurricane season, and new concerns over supply disruptions to the U.S. end-of-the-supply chain in the Gulf of Mexico," he said.

Natural gas gains

Rounding out the action in the energy markets Wednesday, natural-gas futures edged higher, with the May natural-gas contract closing up 8.9 cents at $7.515 per million British thermal units.

The natural-gas market fell more than 3% on Tuesday even after news that Colorado State University researchers was predicting a "much more active" than average 2007 Atlantic U.S. hurricane season. See full story.

In Wednesday's equities trading, benchmarks tracking energy-related shares were mixed, with the Oil Service Index OSX, -2.83% posting a slight decline. See Energy Stocks.

And in other commodities trading, gold futures climbed Wednesday to close at a five-week high. See Metals Stocks.

Taking a broad measure of the commodities markets, the Dow Jones AIG Commodity Index 26099104 was at 172.90 points, up 1.2%. See more of the latest prices for commodity futures.