America’s growing energy independence is paying major dividends this spring, helping to keep a lid on fuel prices despite sudden threats to major global oil supplies in Iraq and Russia that in the past would have sent prices soaring.

Sunni Muslim extremists who have taken over large portions of northern Iraq have shown their willingness to use oil supplies as a weapon, taking control over the nation’s biggest refinery in Baiji temporarily Wednesday after having sabotaged a major pipeline funneling oil through Turkey for export.

Their advance on Baghdad and regions farther south threatens to cripple Iraq’s ability to expand output at its most prolific and important southern oil fields as well, potentially dealing a blow to China and other oil-thirsty Asian nations that were looking to Iraq for supplies in the future.

The Iraq crisis follows Russia’s takeover of Crimea and its backing of rebels fighting the Kiev government in eastern Ukraine, prompting the U.S. and Europe to threaten broad sanctions on Russia’s economy, including its vital oil sector. Such sanctions have the potential to throttle oil exports from the world’s top producer and deprive much of Europe of a critical source of oil.

In the past, either of these two major threats to oil supplies — and certainly both of them together — would have sent world oil prices soaring and pushed prices at U.S. gas pumps to uncomfortable and possibly unprecedented levels. But that is not happening, and analysts are attributing the relative calm, with premium crude prices having risen moderately to a range around $106 a barrel in New York so far this week, to the gusher of oil coming out of America’s heartland, which is holding down prices.

Ben Montalbano, research director for the Energy Policy Research Foundation Inc., said the surge in U.S. oil output from the Bakken, Eagles Ford and other big shale formations in the nation’s midsection not only has created an embarrassment of oil riches that is moderating energy prices in the U.S., but it is also giving the world a substantial margin of excess production capacity that is preventing the kind of astronomical spike in global oil prices seen during comparable oil crises in the past.

“Oil prices would likely be $20 to $40 dollars per barrel higher than they are now,” in the $125 to $150 range, and the OPEC oil cartel would be struggling to address shortages, Mr. Montalbano told the website Real Clear Energy. “Without the increase in U.S. oil production over the past few years, OPEC’s excess capacity would be at or near zero.”

Pump prices rose modestly to around $3.67 a gallon on average this week for regular gasoline in the wake of last week’s extremist takeover of northern Iraq, according to Gasbuddy.com. They remain just slightly above the $3.63 average level this spring and the $3.61 level posted a year ago, and far below the levels over $4 where gas prices regularly landed before the shale oil boom.

The restraint in fuel prices is not entirely new, though it has been noticeable this week. Mr. Montalbano said the glut of oil coming out of the Midwest has had the beneficial effect of holding down oil prices for several years. It enabled the world to easily absorb the loss of 1 million barrels a day of premium crude production caused by the collapse of Libya’s oil industry several years ago, as well as the subsequent loss of 1 million to 1.5 million barrels a day of Iranian crude exports because of a U.S.-led sanctions regime since 2012. Neither of those events had much impact on world oil prices — in a departure from the past.

“Sanctions against Iran, civil war in Libya, and general unrest in the Middle East have all had minimal effects on price volatility — thanks to the U.S. energy renaissance,” said Jared Meyer, a policy analyst at the Manhattan Institute for Policy Research. “The most important contribution to oil’s price stability has been the substantial increase in U.S. production.”

Militants pose serious threat

Despite the subdued market response, analysts say, the seriousness of the potential threats to oil supplies in Iraq should not be underestimated. The International Energy Agency, citing the insurgency, warned Tuesday of “considerable downside risk” to its forecast that Iraq would be able to raise oil production by 1.3 million barrels a day by 2019. It noted that as much as three-fifths of the growth in OPEC output in the next five years was supposed to come from Iraq.

The greatest risk is for China, which now depends on imports from the Middle East for about 60 percent of its oil. The U.S. at one time imported about 1 million barrels a day from Iraq, but does not import any Iraqi or Russian oil today. Still, any shortage of supplies from Iraq has the potential to drive up world oil prices, which in turn would eventually filter down into the U.S. market and raise gas prices.

“The political upheaval puts Iraqi production at risk,” said Jamie Webster, senior director at IHS Energy. “We assume that Iraq’s main producing fields in the south will remain secure for now. However, the militants could seize control of pipelines or other infrastructure links in the oil supply chain.”

That started to happen Wednesday, when reports said militants took control of the country’s main oil refinery in Baiji, only to lose control of the facility Thursday. The fighting there is causing acute shortages of fuel in northern areas of Iraq. Even before that, the stunning advances in recent days of the Islamic State in Iraq and the Levant disrupted the flow of oil in the pipeline running from Kirkuk in Iraq to the port of Ceyhan in Turkey, which got up and running this spring after years of being shut down by war and sanctions.

The militants could target even more vital Iraqi oil infrastructure in the south, Mr. Webster said.

“We do not consider this a high threat at present, but such infrastructure, as well as producing assets, will be a tempting target if [ISIL] offensive moves into higher gear,” he said.

Iraqi Prime Minister Nouri al-Maliki insists there is no threat to the southern oil fields, and BP PLC, Gazprom Neft and other major international oil companies operating there say they have not been affected by the insurgency thus far. But Iraq postponed an auction for the Nassiriya oil field on Tuesday, and the Japanese Petroleum Exploration Co. evacuated its staff in southern Iraq, citing security concerns, according to Platts energy information service.

Iraq’s oil production has averaged around 3.2 million barrels a day, nearly the same level as the estimated 3 million barrels of excess production capacity in other OPEC countries such as Saudi Arabia and Kuwait. Thus any full stoppage of oil production in Iraq, or a partial disruption in both Iraq and Russia, could leave the world living hand to mouth for its oil supplies.

While Iraq’s main oil producing center in the south has not been threatened thus far by the militants, the mere possibility of disruption has pushed the price of premium crude up to $114 a barrel in London trading, and thus is affecting fuel prices more in Europe and Asia than in the U.S. Mr. Webster said further disruptions in Iraqi oil supplies could test the stability that has prevailed in the market thus far.

A spokesman for the International Energy Agency, which would coordinate any release of oil from the U.S. and European strategic oil reserves, said Tuesday that the agency “stands ready” to respond to any disruption in supplies that has the potential to hurt the world economy.