Last year, Internet giant Yahoo built software to spy on incoming emails of hundreds of millions of accounts for U.S. intelligence agencies, according to Reuters.

Citing people familiar with the matter, Reuters reported that Yahoo complied with a classified government directive to scan YahooMail accounts at the request of the National Security Agency or FBI.

The report cited two unnamed former Yahoo employees and a third person who was apprised of the events.

More on this...

It is unknown what intelligence officials were looking for, only that they wanted Yahoo to search for a set of characters, which could mean a phrase in an email, the sources said. It is also unknown what information, if any, was handed over, and if intelligence officials approached other email providers with similar requests.

The former employees told Reuters that Yahoo Chief Executive Marissa Mayer's decision to comply with the directive ruffled more than a few feathers in the company’s C-Suite and led to Chief Information Security Officer Alex Stamos’ departure in June 2015.

“Yahoo is a law abiding company, and complies with the laws of the United States," said Yahoo, in a statement emailed to FoxNews.com.

The Office of the Director of National Intelligence also declined to comment on the Reuters report.

This report comes on the heels of Yahoo’s announcement that "state-sponsored" hackers had gained access to 500 million customer accounts in 2014