Only a third of the agents, officers and other staff at the Secret Service are happy with their jobs and would recommend the agency responsible for protecting the president as a good place to work, a survey released Tuesday found.

This poor morale, with just 33.4 percent of employees expressing job satisfaction this year, down from 65.8 percent in 2011, reflects a force beset by a string of embarrassing security lapses and a staffing shortage highlighted by House investigators last week. But the Secret Service’s failure to fix the many deeply ingrained problems that were exposed last year underscores a continuing struggle across government to improve leadership and the engagement of employees in their jobs, the 10th annual Best Places to Work in the Federal Government rankings found.

The good news for federal leaders is that a steady drop in morale that began in 2010 may finally have bottomed out after a government shutdown, budget cuts known as sequestration and a three-year pay freeze. After hitting a four-year low in 2014, federal employees’ overall satisfaction with their leaders and supervisors and work experience rose 1.2 points this year to 58.1 percent.

But despite the Obama administration’s focused efforts — and successes — in the last year to improve what’s known as “employee engagement,” job satisfaction remains far lower than in the private sector, according to the nonpartisan Partnership for Public Service, which puts out the “Best Places” rankings with the consulting group De­loitte.

Effective leadership remains the primary barometer of how federal employees feel about their jobs, with pay and confidence that their skills match their agency’s mission just behind.

This year’s score for senior leaders, even with a jump of 1.4 percent over 2014, remains low at 43.8 percent. In survey after survey, federal workers say their chance at a promotion is based not on merit but on favoritism. They perceive that their agency does not punish poor performers. Many do not feel their work is recognized.

“The low grades given by employees to government managers is a flashing red light that greater attention must be paid to developing leadership skills at all levels,” said Max Stier, the partnership’s president.

Low morale poses challenges for the next president, who is likely to face decisions on immigration, the environment, terrorism and homeland security policies, social programs and a host of government services. Experts agree that good morale is closely tied with good service to taxpayers.

“To address these challenges, the next president will need to effectively lead our government and motivate our public servants,” Stier said. “It would be a mistake to forget that our government is only as good as its people.”

The rankings serve as road map for Cabinet secretaries and their deputies, who began in the last year to make employee “engagement” a priority.

The survey shows a big gap between the happiness of senior executives —of whom 82.9 percent like their jobs, a 1.1-point increase from 2014 — and the rest of the overall workforce, which came in at 58.1 percent.

Employees say they are committed to their agency’s mission, which may explain why NASA, with it cutting-edge research, technology and space exploration tops the list as the best large place to work in the government for a fourth year running. The intelligence community follows in the No. 2 spot. with the Justice and State departments tied for third.

The Federal Deposit Insurance Corporation, which insures deposits in banks and thrift institutions, took the top spot for mid-sized agencies, with the Peace Corps at No. 2. The Federal Mediation and Conciliation Service was the top-ranked small agency, and the tiny watchdog over the Tennessee Valley Authority was ranked highest among departments with at least 100 employees. (96.3 percent said they like their jobs).

But at the bottom, just 43.1 percent of employees at the sprawling Department of Homeland Security said they’re satisfied at work, making DHS the lowest-ranked large agency, again, followed by the Department of Veterans Affairs and the Army after that.

Commerce Department dropped the most among large agencies, by 2.5 points, but held onto its 5th place ranking with a score of 66.2 percent. Turmoil in the inspector general’s office, where the former head of the watchdog agency was under investigation for misconduct and eventually retired, was a likely factor.

So was the U.S. Patent and Trademark Office, another department in Commerce, which showed a decline of 8 points after The Washington Post reported last year about fraudulent time and attendance practices, particularly in the department’s award-winning telework program. A spokesman declined to comment on the rankings.

The Treasury Department dipped 2.1 percent, putting it in 16th place out of 19 large agencies. The biggest decline for a mid-size agency was at the Federal Communications Commission, which dropped 8 points to a score of 59.4.

The “Best Places” survey ranks 391 federal agencies from the Defense Department to the Surface Transportation Board, covering about 97 percent of the workforce. The rankings are based on data from the Office of Personnel Management’s annual survey of the workforce, which was given to executive branch employees in April through June. The results include another eight agencies in other branches of government, plus the intelligence community.

Overall morale improved at 70.4 percent of the agencies in 2015,
compared to only 43.1 percent in 2014 and 24 percent in 2013, even if by relatively small numbers.

Personnel experts pay close attention to improving scores, since they tend to reflect internal efforts to fix problems. Most improved for large agencies for a second year is the Labor Department, which jumped 4.4 points and is ranked 8th. The Air Force rose by 3.2 points. And Housing and Urban Development came in at the most improved mid-size agency, jumping 8 points for a score of 52.3 percent, although HUD still is ranked just 21st out of 24.

HUD Secretary Julian Castro, in an interview, credited the efforts of senior leaders to connect employees’ everyday jobs with the agency’s mission of helping low income Americans find housing.

“We’re trying to listen to employees in a better way and act on the recommendations they give us for improvements,” Castro said. “We need to more strongly connect the mission to the work.”

He cited a reinvigorated candidate development program for senior executives, a rotation program for employees to master new areas of the agency and a new program that allows HUD to share some office functions with other agencies. “This frees up employees’ time so they are doing less rote work,” Castro said.

For the first time, the rankings looked at occupations across the government with missions viewed as critical or in short supply: Auditors, contract and acquisition specialists, economists, human resources staff and information technology experts. Economists were the happiest of these employees, with technology geeks at the bottom.

In another first, the survey grouped 75 departments by six mission areas: public health, law enforcement, national security, energy and environment, financial regulation and oversight. The data show a wide range of scores among agencies with similar workforces and responsibilities.The FBI, for example, tops the law enforcement category with a satisfaction and commitment score of 69.9, while the Secret Service is at the bottom.

In a critical report released last week, House investigators describe the once-elite force as an “agency in crisis” that has failed to fix many deeply ingrained problems that led to its  halting response to a 2011 shooting at the White House and an incident last year in which an armed man with an arrest record was able to board an elevator with President Obama.

The report also found a “staffing crisis,” with fewer personnel today than in 2014, when an administration panel recommended adding 280 new agents and other staff and Director Joseph P. Clancy took over vowing to enact the reforms.

Spokesman Robert Hoback said the agency did not yet have a statement on its survey rankings.