Yahoo secretly scanned the emails of hundred of millions of customers, it has been revealed.

The company complied with a classified U.S. government directive to search its customers’ incoming emails.

It secretly built a custom software program in 2015 to scan hundreds of millions of Yahoo Mail accounts at the behest of the National Security Agency or FBI last year, two former employees and a third person apprised of the events told Reuters.

Yahoo Chief Executive Marissa Mayer’s decision to obey the directive sparked a huge rift in the company, roiling some senior executives and leading to the June 2015 departure of Chief Information Security Officer Alex Stamos, who now holds the top security job at Facebook.

It is not known what information intelligence officials were looking for, only that they wanted Yahoo to search for a set of characters – that could mean a phrase in an email or an attachment, said the sources, who did not want to be identified.