Yahoo! Sunnyvale headquarters.
Yahoo! Sunnyvale headquarters.

SAN FRANCISCO (Diya TV) — Yahoo last year secretly constructed a custom software platform to search all of its customers’ incoming emails for specific information provided by U.S. intelligence officials, according to a report from Reuters.

The program was made in compliance with a classified U.S. government directive, the report said, which cited the accounts of three former employees who worked on it. It scanned hundreds of millions of Yahoo Mail accounts at the behest of the National Security Agency or FBI.

Some surveillance experts said this represents the first case to surface of a U.S. Internet company agreeing to a spy agency’s demand by searching all arriving messages, as opposed to examining stored messages or scanning a small number of accounts in real time. What information intelligence officials were scouting for remains unknown, but initial reports indicate Yahoo were scanning for specific characters. That could mean a phrase in an email or an attachment.

According to the two former employees, Yahoo Chief Executive Marissa Mayer’s decision to obey the directive roiled some senior executives and led to the June 2015 departure of Chief Information Security Officer Alex Stamos, who now holds the top security job at Facebook Inc.

“Yahoo is a law abiding company, and complies with the laws of the United States,” the company said in a brief statement in response.

Diya TV’s efforts to obtain comment from the National Security Agency were referred to the Office of the Director of National Intelligence, which declined to comment.

U.S. phone and Internet companies are known to have handed over bulk customer data to intelligence agencies. But some former government officials and private surveillance experts said they had not previously seen either such a broad directive for real-time Web collection or one that required the creation of a new computer program.

“I’ve never seen that, a wiretap in real time on a ‘selector,”‘ said Albert Gidari, a lawyer who represented phone and Internet companies on surveillance issues for 20 years before moving to Stanford University this year.

“It would be really difficult for a provider to do that,” he added.

Under laws including the 2008 amendments to the Foreign Intelligence Surveillance Act, intelligence agencies can ask U.S. phone and Internet companies to provide customer data to aid foreign intelligence-gathering efforts for a variety of reasons, including prevention of terrorist attacks.