SAN FRANCISCO — Yahoo secretly agreed to search all its users incoming emails for a specific but unknown word or phrase on behalf of either the National Security Agency or the FBI, Reuters reported Tuesday.

This appears to be the first case of a U.S.-based Internet company searching all incoming messages rather than scanning stored messages or focusing on a small number of accounts.

Persons who were familiar with the matter, Reuters reported, did not know what, specifically, the agencies were searching for beyond that it was a specific set of characters.

Asked to comment, Yahoo told USA TODAY via email, “Yahoo is a law abiding company, and complies with the laws of the United States."

According to the Reuters story, the decision to do the search led to the departure of the company's chief Information security officer Alex Stamos in June of 2015 after 16 months in the position. Stamos went on to become the chief security officer at Facebook that same month.

In a post on Facebook announcing his move, Stamos said, "the Internet has been an incredible force for connecting the world and giving individuals access to personal, educational and economic opportunities that are unprecedented in human history. These benefits are not without risk, and it is the responsibility of our industry to build the safest, most trustworthy products possible."

Yahoo has been in the news recently for many reasons. A months-long sale process concluded in July with Verizon emerging as the winning bidder, paying $4.8 billion for Yahoo’s operating business, including its advertising technology and popular online content such as Yahoo Sports, Yahoo Finance and micro-blogging site Tumblr.

But the merging process has been slowed by the revelation two weeks ago that the Net media company the victim of one of the largest data breaches ever. At least 500 million Yahoo accounts were stolen from the company in 2014 in what it thought was a hack by a state-sponsored actor, Yahoo said. Data acquired may have included names, email addresses, telephone numbers, dates of birth, and in some cases, encrypted or unencrypted security questions and answers.