Microsoft, whose email service is larger than Yahoo's, said it has never secretly scanned emails.
News agency Reuters reports that the tech firm built special software previous year which was able to scan for a string of characters in response to a classified request from either the National Security Agency or Federal Bureau of Investigation. However, some former government officials and private surveillance experts said they had not previously seen either such a broad demand for real-time Web collection or one that required the creation of a new computer program. It's also unknown what the government officials were looking for and what, if any, data Yahoo turned over to the government, the person said.
Yahoo has been having something of a rough time of late, and things are not getting any easier. "Separately, while federal law prohibits companies from being able to share information about certain types of national security related requests, we are now suing the Justice Department for the ability to disclose more information about government requests", Twitter told Vocative.
Yahoo's approach to the security of its hundreds of millions of users has been put under a microscope amid revelations of a massive hack that went unreported for years and the company's undisclosed collaboration with the nation's top spy agency.
Facebook also said it would fight such a request should it receive one.
Under the Foreign Intelligence Surveillance Act, intelligence agencies can ask phone and internet companies to relay customer data to aid foreign intelligence-gathering efforts.
The co-operation with the government's spying on emails created a rift between Mr Stamos and Yahoo chief executive Marissa Mayer, prompting Mr Stamos to leave in June 2015, according to Reuters.
The company has fought a previous government request for data.
"We've never received such a request, but if we did, our response would be simple: "No way", a spokesman for Google said. Stamos and the security team only learned of the program after testing Yahoo's systems for vulnerabilities and discovering software they thought had been inserted by hackers.
But it's not clear what information the United States authorities were looking for, nor what data Yahoo provided. Due to a programming flaw, he told them hackers could have accessed the stored emails. Patrick Toomey, a staff attorney with the American Civil Liberties Union, called Yahoo's reported acquiescence to a government order "deeply disturbing", adding in his statement that the order itself appears to be "unprecedented and unconstitutional".
Last month, Yahoo revealed that the details of 500 million users had been stolen by what it described as a "state-sponsored actor", with eight million Britons among those affected.
Questions over Yahoo's stewardship of user email could threaten the company's deal to sell its online operations to Verizon Communications for $4.8 billion.