Updated from 3:15 p.m. EDT

Oil prices ended just below $40 a barrel Friday, but traders remained worried about short-term supplies and the possibility of terror attacks on the U.S. in the near future.

The benchmark U.S. crude lost 37 cents, or 0.9%, to $39.96, having closed at a one-month high Thursday, after U.S. authorities warned about al-Qaeda action ahead of the presidential election. Gasoline futures Friday ended about half a cent lower at $1.322 a gallon.

Recently traders have been focusing on production issues in Russia and Iraq.

Russia's largest oil company, Yukos, is embroiled in a major tax dispute with the government and there's speculation that the company could be forced into bankruptcy if pressed to make a huge tax payment, which would likely hurt production and exports.

Iraq, meanwhile, is once again struggling to restore exports to a normal level following problems with a pipeline over the weekend.

Prices have jumped more than $4 since last Tuesday, when they closed below $36 a barrel for the first time in three months.

The recent rally took a brief pause Wednesday after Saudi Arabia -- the world's largest oil exporter and the dominant member of the Organization of Petroleum Exporting Countries -- signaled that the oil cartel had already decided to increase its production ceiling by half a million barrels a day in August. OPEC had previously said it would meet in July to consider the measure. The meeting isn't scheduled until July 21.

The measure was part of a broader agreement reached at OPEC's June meeting, when it decided to increase official production by two million barrels a day in July.

At one point, oil prices had fallen 15% from their record high of more than $42 a barrel, reached the day before OPEC's June 3 meeting.

During May, traders bid up prices on short-term supply concerns triggered by strong global demand and terrorist attacks on oil industry personnel and facilities in the Persian Gulf region ahead of the peak summer driving season in the U.S. and Europe.

If you liked this article you might like

Spain to Play Netherlands for World Cup

Spain to Play Netherlands for World Cup

Wal-Mart: Analysts' Upgrades, Downgrades

Wal-Mart: Analysts' Upgrades, Downgrades

Netherlands Advances to World Cup Final

Netherlands Advances to World Cup Final

Apple: Analysts' Upgrades, Downgrades

Apple: Analysts' Upgrades, Downgrades

World Markets Mostly Lower Monday

World Markets Mostly Lower Monday