A federal judge in California has ruled that Yahoo’s insurer failed to defend and indemnify the company by refusing to foot $4 million in outside counsel fees from litigation over the tech company’s practice of scanning user emails for advertising purposes.

In an order on motions for summary judgment, U.S. District Judge Edward Davila of the Northern District of California wrote Yahoo was “largely correct” in assuming legal fees incurred in a consolidated 2016 class action were covered under a “personal injury” policy purchased from National Union. The insurer had argued Yahoo’s costs didn’t fit within the policy’s definition of a personal injury as damages accrued via the “oral or written publication … of material that violates a person’s right to privacy,” a view that Davila said is “incorrect.”