Oil prices rallied sharply on Oct. 9 as investors reacted to the escalating conflict between Hamas and Israel that erupted over the weekend.

Brent crude futures, the global oil benchmark, rose by as much as 5.2% to $89.00 a barrel. U.S. benchmark West Texas Intermediate peaked at $87.24 a barrel, a gain of 5.7%.

Commodity analysts like Vandana Hari, head of commodity intelligence firm Vanda Insights, anticipated a “knee-jerk surge” in oil prices when markets opened on Monday.

"There will be some risk premium factored in as a default until the market is satisfied that the event is not setting off a chain reaction and Mideast oil and gas supplies won’t be affected,” Hari told CNBC.

While neither Israel nor the Palestinian territories are major oil producers, there's a risk of a broader conflict in the region involving OPEC members. Analysts think those fears are muted for now, but their outlook depends on one crucial factor.

Assessing the impact on oil prices

“For this conflict to have a lasting and meaningful impact on oil markets, there must be a sustained reduction in oil supply or transport,” according to Vivek Dhar, the director of mining and energy research at Commonwealth Bank.

Iman Nasseri, managing director at Facts Global Energy, agrees with Dhar but offers one crucial caveat: “The impact on the oil price will be limited unless we see the ‘war’ between the two sides expand quickly to a regional war where the U.S. and Iran and other supporters of the parties get directly involved.”

An Oct. 8 report from The Wall Street Journal blamed Iran for planning Hamas’ incursion beyond Gaza, prompting U.S. Senator Lindsey Graham to proclaim that Iran should face the consequences for the attack.

Iran’s mission to the United Nations acknowledged Hamas’ “wholly legitimate defense against seven decades of oppressive occupation” but said Hamas acted independently.

While a direct confrontation between the U.S. and Iran seems unlikely, their proxies are a different matter.

Israel has already begun bombing Lebanon, home to the powerful Iranian-backed Hezbollah, after the group launched rockets into the Israeli-occupied Shebaa Farms over the weekend.

According to analysts, the severity of Israel’s actions in Gaza could dictate whether Hezbollah joins the war.

Oil could be heading higher regardless

Oil prices looked poised to return to $100 a barrel even before the recent conflict unfolded. Brent crude touched $95 last month after Saudi Arabia and Russia—the world’s second- and third-largest oil producers, respectively—extended production cuts through the end of the year.

According to reports, the Saudis were willing to raise oil production—thereby putting a cap on prices—to secure a normalization deal with Israel. But that appears to be off the table after Saudi Arabia backed out of the agreement following Israel’s Gaza strikes.

Another factor that could push oil prices higher is the U.S.’s assessment of Iranian involvement in Hamas’ actions this weekend.

“If the U.S. were to judge that Iran is involved in Hamas' attack, this could lead it to 'turn the screws' on Iran's oil exports by enforcing sanctions more strictly,” Caroline Bain, chief commodities economist at Capital Economics, told Reuters.

That could jeopardize 600,000 barrels per day of Iranian crude.