Yahoo chief Marissa Mayer said she feared winding up in prison for treason if she refused to comply with US spy demands for data.
Her comments came after being asked what she is doing to protect Yahoo users from "tyrannical government" during an on-stage interview at a TechCrunch Disrupt conference in San Francisco.
Mayer said Yahoo scrutinizes and fights US government data requests stamped with the authority of a Foreign Intelligence Surveillance Court, but when the company losses battles it must do as directed or risk being branded a traitor.
Data requests authorized by the court come with an order barring anyone at the company receiving the request from disclosing anything about them, even their existence.
"If you don't comply, it is treason," Mayer said when asked why she couldn't just spill details of requests by US spy agencies for information about Yahoo users.
"We can't talk about it because it is classified," she continued. "Releasing classified information is treason, and you are incarcerated. In terms of protecting our users, it makes more sense to work within the system."
Yahoo, Google, Facebook, and Microsoft are among Internet firms pushing for permission to disclose more details to users about demands for data made in the name of fighting terrorism or other threats.
Technology titans have been eager to bolster the trust of its users by making it clearer what has actually been demanded by and disclosed to US authorities.
"It is our government's job to protect all of us and also protect our freedoms and protect the economy and protect companies," said Facebook co-founder and chief Mark Zuckerberg said at TechCrunch Disrupt on Wednesday.
"Frankly, I think the government blew it."
US intelligence officials declassified documents Tuesday revealing the National Security Agency violated privacy rules for three years when it sifted through phone records of Americans with no suspected links to terrorists.
The revelations raised fresh questions about the NSA's ability to manage the massive amount of data it collects and whether the US government is able to safeguard the privacy of its citizens.
The government was forced to disclose the documents by a judge's order after a Freedom of Information lawsuit filed by the Electronic Frontier Foundation, a non-profit group promoting digital privacy rights and free speech.
The foundation called the release of the documents a "victory" for transparency but intelligence officials said the papers illustrated how the spy service had made unintentional "mistakes" that were rectified under strict judicial oversight.
The release came after the scale of NSA spying was exposed in a series of bombshell media leaks in recent months by former US intelligence contractor Edward Snowden, who has been granted temporary asylum in Russia.
Documents divulged by Snowden have shown the NSA conducts a massive electronic dragnet, including trawling through phone records and online traffic, that has sometimes flouted privacy laws.
The declassified documents released on Tuesday shed light on friction between the NSA and the court, with judges castigating the agency for failing to abide by their orders and misrepresenting the nature of their data collection.