LONDON — Within days of a cyberattack, warehouses of the snack foods company Mondelez International filled with a backlog of Oreo cookies and Ritz crackers.

Mondelez, owner of dozens of well-known food brands like Cadbury chocolate and Philadelphia cream cheese, was one of the hundreds of companies struck by the NotPetya cyberstrike in 2017. Laptops froze suddenly as Mondelez employees worked at their desks. Email was unavailable, as was access to files on the corporate network. Logistics software that orchestrates deliveries and tracks invoices crashed.

Even with teams working around the clock, it was weeks before Mondelez recovered. Once the lost orders were tallied and the computer equipment was replaced, its financial hit was more than $100 million, according to court documents.

After the ordeal, executives at the company took some solace in knowing that insurance would help cover the costs. Or so they thought.

MBA BY THE BAY: See how an MBA could change your life with SFGATE's interactive directory of Bay Area programs.

Mondelez’s insurer, Zurich Insurance, said it would not be sending a reimbursement check. It cited a common, but rarely used, clause in insurance contracts: the “war exclusion,” which protects insurers from being saddled with costs related to damage from war.

Mondelez was deemed collateral damage in a cyberwar.

The 2017 attack was a watershed moment for the insurance industry. Since then, insurers have been applying the war exemption to avoid claims related to digital attacks. In addition to Mondelez, pharmaceutical giant Merck said insurers had denied claims after the NotPetya attack hit its sales research, sales and manufacturing operations, causing nearly $700 million in damage.

When the U.S. government assigned responsibility for NotPetya to Russia in 2018, insurers were provided with a justification for refusing to cover the damage. Just as they would not be liable if a bomb blew up a corporate building during an armed conflict, they claim not to be responsible when a state-backed hack strikes a computer network.

The disputes are playing out in court. In a closely watched legal battle, Mondelez sued Zurich Insurance in 2018 for breach of contract in an Illinois court, and Merck filed a similar suit in New Jersey in August. Merck sued more than 20 insurers that rejected claims related to the NotPetya attack, including several that cited the war exemption. The two cases could take years to resolve.

The legal fights will set a precedent about who pays when businesses are hit by a cyberattack blamed on a foreign government. The cases have broader implications for government officials, who have increasingly taken a bolder approach to naming-and-shaming state sponsors of cyberattacks, but now risk becoming enmeshed in corporate disputes by giving insurance companies a rationale to deny claims.

“You’re running a huge risk that cyberinsurance in the future will be worthless,” said Ariel Levite, a senior fellow at the Carnegie Endowment for International Peace, who has written about the case. But he said the insurance industry’s position on NotPetya is “not entirely frivolous, because it is widely believed that the Russians had been behind the attack.”

Cyberattacks have created a unique challenge for insurers. Traditional practices, such as not covering multiple buildings in the same neighborhood to avoid the risk of, say, a big fire do not apply. Malware moves fast and unpredictably, leaving an expensive trail of collateral damage.

“It cuts across practically every type of business activity,” Levite said. The risk, he said, “no longer can be contained in this interconnected world.”

NotPetya — which picked up the odd name because security researchers initially confused it with a piece of ransomware called Petya — was a vivid example. It was also a powerful assault on computer networks that incorporated a stolen National Security Agency cyberweapon.

U.S. officials tied the attack to Russia and its conflict with Ukraine. The original target was a Ukrainian tax-software-maker and its Ukrainian customers. In just 24 hours, NotPetya wiped clean 10 percent of all computers in Ukraine, paralyzing networks at banks, gas stations, hospitals, airports, power companies and nearly every government agency, and shutting down the radiation monitors at the old Chernobyl nuclear power plant.

The attack made its way to the software-maker’s global clients, eventually entangling Mondelez and Merck, as well as Danish shipping conglomerate Maersk and FedEx’s European subsidiary. It hit even Russia’s state-owned oil giant, Rosneft.

In a statement in 2018, the White House described NotPetya as “part of the Kremlin’s ongoing effort to destabilize Ukraine” and said it had demonstrated “ever more clearly Russia’s involvement in the ongoing conflict.”

Many insurance companies sell cyber coverage, but the policies are often written narrowly to cover costs related to the loss of customer data, such as helping a company provide credit checks or cover legal bills.

Mondelez, a former unit of Kraft Foods, argues that its property insurance package should cover the losses from the NotPetya attack. In court filings, Mondelez said its policy had been updated in 2016 to include losses caused by “the malicious introduction of a machine code or instruction.”

The company lost 1,700 servers and 24,000 laptops. Employees were left to communicate through WhatsApp, and executives posted updates on Yammer, a social network used by companies.

Damage from NotPetya spread all the way to Hobart, Tasmania, where computers in a Cadbury factory displayed ransomware messages that demanded $300 in bitcoin.

Courts often rule against insurers that try to apply the wartime exemption. After hijackers destroyed a Pan Am airliner in 1970, a U.S. court rejected Aetna’s attempt, determining that the action was criminal, not an act of war. In 1983, a judge ruled that Holiday Inn’s insurance policy covered damage from the civil war in Lebanon.

In the Mondelez and Merck lawsuits, the central question is whether the government’s attribution of the NotPetya attack to Russia meets the bar for the war exclusion.

Risk industry experts say cyberwar is still largely undefined. Attribution can be difficult when attacks come from groups with unofficial links to a state and the blamed government denies involvement.

“We still don’t have a clear idea of what cyberwar actually looks like,” said Jake Olcott, vice president at BitSight Technologies, a cyber risk adviser. “That is one of the struggles in this case. No one has said this was an all-out cyberwar by Russia.”

Adam Satariano and Nicole Perlroth are New York Times writers.