It's been a bruising few years for America's spies.
Revelations about torture by the CIA and sweeping electronic spying on the part of the NSA have hurt their public image, casting them as aggressive or nosy rather than — as they tend to see themselves — quiet patriots forced to work in obscurity to protect the nation.
Officials say falling morale has affected the agencies' ability to hold on to employees — often highly skilled analysts and technicians who could earn many times as much money in the private sector.
The National Security Agency, the electronic eavesdropping outfit headquartered at Fort Meade, has seen attrition increase by half in the past year.
And now they face a new challenge: laboring for a boss who has shown little interest in their work.
As a candidate, Donald Trump dismissed the intelligence community's conclusion that Russia had hacked the Democratic National Committee's emails. As president-elect, he has said he doesn't need the daily intelligence briefing ordinarily given to presidents.
And when the CIA concluded that Russian hacks were aimed specifically at getting Trump elected, his aides attacked the messenger.
"These are the same people that said Saddam Hussein had weapons of mass destruction," his transition team said.
Rep. C.A. Dutch Ruppersberger, whose district is home to the NSA and many of its employees, said the president-elect needs to take time to better understand what the country's spies do, and how they can help him govern.
The Baltimore County Democrat, who served a record 12 years on the House Intelligence Committee, said he has been urging Rep. Mike Pompeo, the Kansas Republican Trump has picked to lead the CIA, to intercede.
"No president of the United States can be an effective commander in chief unless he relies on his intelligence agencies," Ruppersberger said. "He's going to need these agencies just like he's going to need the military."
Trump told Fox News last week that the stories about Russia were being spread by his Democratic opponents, and the intelligence community didn't know who was behind the hacks.
He said he didn't need regular intelligence briefings because "you know, I'm, like, a smart person."
Mark Stout, the director of the intelligence program at the Johns Hopkins University, said other presidents have come into office skeptical about the intelligence community.
Richard Nixon was suspicious of the CIA for what he saw as its tendency to hire elites from fancy schools. Jimmy Carter was concerned by the agency's covert action programs.
"This is a serious profession that only a few people are able to do," said Stout, a former analyst for the State Department and the CIA. "This takes real work and real expertise. And to have someone dismiss it out of hand as being done for partisan reasons or being done by a group of incompetents has got to rankle."
The NSA has long focused on retaining its highly skilled employees. Part of the agency's pitch is its mission: It offers them a unique opportunity to protect their nation.
But now the agency at Fort Meade is in the midst of a major reorganization that has proved unpopular in some quarters.
The NSA was once so secret that government officials denied its existence — the joke was the acronym stood for No Such Agency.
But it has been buffeted by the unusually public revelations of its worldwide spying programs by Edward Snowden.
Snowden, a former NSA contractor from Maryland, revealed programs that collected emails and other electronic communications involving suspected terrorists, and gathered data on huge numbers of telephone calls involving, potentially, anyone.
Keith Alexander, the former Army general who led the NSA until 2014, said the agency and its work have been misunderstood, which has damaged employee morale.
Agency officials have taken pains to explain that while the NSA gathered "telephony metadata" — phone numbers, and the times and lengths of the calls — the agency did not record or listen to the conversations themselves.
The email program did capture Americans' communications in some cases.
Current NSA Director Adm. Michael Rogers has said that the increased monitoring of employees since Snowden made off with secrets and fled the country has also frustrated the staff.
Meanwhile stories like the one Alexander shared at the University of Maryland this month — about hundreds of agency employees helping to stop a Christmas Day bomb attack in Afghanistan— often don't make it to the public.
An internal NSA document obtained by The Baltimore Sun shows the agency had been grappling with ways to retain its employees for years before Snowden. The agency began to notice an uptick in attrition in 2009.
The NSA's current attrition rate is just under 6 percent, a spokesman said Friday. That's up from the less than 4 percent cited by Rogers in January.
One hundred seventeen technical workers resigned between October 2015 and March 2016, according to the document.
The agency asked them their reasons for leaving; six in 10 who responded said the cost of living in Maryland led to their decision.
One employee cited different parking arrangements after getting a new assignment.
"Changing positions … added another 10 to 15 minutes to each end of the day for parking," the employee wrote.
Others said better pay would have convinced them to stay. But many have technical skills that can prove more lucrative in the private sector than in government.
"NSA is creating the talent other organizations need," the document reads.
The document predates the implementation of NSA21, the reorganization effort.
Intended to allow the agency to more effectively fight hackers and gather information online, NSA21 ended the traditional distinction between defensive and offensive teams. But it also split some units apart — the elite Tailored Access Operations hacking team, for example, has faced a shake-up, two people familiar with the changes said.
Different functions of the unit are being split among new divisions created by the NSA21 program, according to a former cyber operative who retains close ties to the agency, and that means managers have less autonomy to make independent decisions, and have to fight harder for resources.
"Leadership doesn't like it at all," said the former operative, who asked for anonymity to discuss the agency's operations.
Ruppersberger said that he was monitoring the reorganization and that some employees were unhappy.
"No one likes change or reorganization," he said.
Kathy Hutson, the agency's human resources chief, said the agency continues to attract the kinds of workers it needs to carry out its mission.
Alexander, the former director, said a combination of poor morale inside the agency and attractive opportunities outside could push employees away.
"People with cyber experience in some of these large companies make up to seven figures," he said. "That's five times what the chairman of the Joint Chiefs makes.