By Christian Berthelsen 

U.S. crude prices gained on Friday, after a session of choppy trading, as investors assessed the potential impact of the U.S. airstrikes in Iraq on global oil supplies.

Light, sweet crude for September delivery rose 31 cents, or 0.3%, in price to settle at $97.65 a barrel on the New York Mercantile Exchange. The market traded in a range of $1.30 between the day's highs and lows, turning negative for part of the session before climbing back in the afternoon.

The global Brent crude-oil contract also seesawed, trading over a range of $2.18 and at one point hitting a one-week high. Brent crude for September delivery ended down 42 cents at $105.02 a barrel on the ICE Futures Europe exchange.

Andy Lebow, a trader at investment bank Jefferies, said some market participants were placing bets on prices either rising or falling, as they sought to assess the impact of the airstrikes and how the market might interpret them.

U.S. jet fighters hit artillery being used by the Islamic State militant group in northern Iraq on Friday.

There seemed to be little immediate impact on global supplies, but if the Sunni Muslim extremists succeed in overrunning the semiautonomous Kurdish region in northern Iraq, it could show they also have the ability to also push south through Baghdad and to Iraq's main oil-producing region.

"It appears as though the oil market is back looking at the geopolitics vis-à-vis Iraq," Mr. Lebow said. "The market is uncertain on this."

Oil prices had jumped nearly 80 cents Thursday night after President Barack Obama announced the strikes. But the market sold back down early Friday. The amount of oil at risk from Kurdistan is small in the global supply-demand balance, about 200,000 barrels a day.

Also on Friday, the Organization of the Petroleum Exporting Countries said production rose to its highest level in five months in July, reflecting renewed output in Libya. And consumption data provided a mixed picture, with China saying crude imports in July rose 2% from June but remain down 9% from year-ago levels.

Front-month September gasoline futures fell 1.86 cents to $2.7537 a gallon. September diesel lost 1.88 cents to $2.8769 a gallon.

Write to Christian Berthelsen at christian.berthelsen@wsj.com