Chip Somodevilla / Getty Images Former National Intelligence Director John McConnell, testifying before the Senate in 2007, is vice chairman of Booz Allen Hamilton.

For Booz Allen Hamilton, protecting government secrets is also a matter of protecting billions of dollars in business.

So when Edward Snowden, who had worked at the strategy and consulting firm less than three months, leaked the details of massive government surveillance programs, it presented not just a security debate for the country but a public relations problem for the company.

Booz Allen, which sells technical expertise and data analysis to the government, depends on government contracts — taxpayer money, in other words — for almost all of its more than $5.8 billion in annual revenue, and it boasts to shareholders about its deep ties to the federal government.

“You can count on us,” the company said in its most recent annual report.

On Monday, Wall Street was not so sure. After Snowden revealed himself as the source of articles in two newspapers over the weekend, investors sent Booz Allen stock down as much as 5 percent, wiping out tens of millions of dollars in market value.

The company said Tuesday that it had fired Snowden for violating its code of ethics and company policy. It declined further comment to NBC News.

Booz Allen is particularly intertwined with the National Security Agency and the rest of the intelligence complex.

Jeffrey MacMillan / For The Washington Post Booz Allen Hamilton's Cyber Solution Center in Annapolis Junction, Md.

More than three-quarters of its 25,000 employees have government security clearance, and about half have clearance of “Top Secret or higher,” the company says. Secrecy is so important to Booz Allen that it warns investors that they may not always be able to tell how it makes its money.

In light of the leak, “Money and man-hours are going to be flying out the windows,” said Scott Sobel, president of Media & Communications Strategies, a Washington crisis-management company. Booz Allen has not been a client.

The company’s existing contracts may not be damaged, but Sobel said that Booz Allen is certain to shoulder extensive legal fees, federal investigations and news media scrutiny in the months to come.

He suggested that Booz Allen look for former cabinet-level security advisers and former leaders of the CIA and NSA to perform an investigation and make recommendations about how to stop leaks in the future.

Hiring high-level former government officials has not been a problem for Booz Allen. Its vice chairman is John McConnell, the former director of national intelligence, who was paid $2.3 million by the company last year, according to a company regulatory filing.

The company is part of a security and defense outsourcing industry that has exploded since Sept. 11, 2001, enriching companies like Halliburton and the former Blackwater, which also kept a healthy business with Washington despite damaged reputations.

A federal report last fall found that 1.4 million Americans had top-secret security clearance, including almost half a million government contractors.

The Project on Government Oversight, which keeps a database of what it calls misconduct by federal contractors, has identified only three violations by Booz Allen since 1995 — a relatively small number, according to the database, for such a large contractor.

They included overbilling the government for travel, a charge that led Booz Allen to settle with the government in civil court for $3.3 million in 2005. The company did not admit wrongdoing.

“Their track record up to his point has been fairly clean,” said Scott Amey, the oversight project’s general counsel. “I’m not sure that the company has done anything wrong.”

But the case of Snowden, whose whereabouts Tuesday were unknown, has shined a light on how deeply reliant the federal government is on contractors, Amey said.

“These contractors are in very sensitive positions that allow them to have access to the most sensitive and secret government programs,” Amey said. “And we need checks and and balances on the system.”

The company is already facing questions about its decision to hire Snowden, who told The Washington Post, “I’ve been a spy almost all of my adult life,” and who used code names to communicate with a Post reporter.

“We do have in our intelligence community and our military some very young people, many of whom have access to highly sensitive information,” Jeremy Bash, former chief of staff to Defense Secretary Leon Panetta, told MSNBC.

“The question of how he slipped in,” he said, “That’s the question that investigators are going to want to know.”

Perhaps realizing the risk to its reputation, the company came down hard Sunday when Snowden outed himself.

Less than three hours after The Guardian posted its report, the company issued a statement saying that the report was shocking and, if accurate, was a “grave violation of the code of conduct and core values of our firm.”