Salary freezes, tight budgets and a dim view of federal work held by many Americans have soured the motivation and commitment of many government employees, a survey released Wednesday found.

Federal employees still think that their jobs are important, and many are passionate and dedicated to their agency’s mission. But increasing threats to their pay and benefits and criticism of their work that has percolated in the national debate over government spending have taken a toll on morale, results of the Employee Viewpoint Survey show.

“Today’s federal leaders are facing significant challenges in keeping the workforce motivated and engaged in light of frozen salaries, slashed budgets, and recent public sentiment toward federal employees,” John Berry, the government’s personnel chief, wrote in the introduction to the survey, which was posted on the Office of Personnel Management’s Web site Wednesday.

Government-wide scores on leadership, pay, opportunities for advancement, innovation and other markers of how employees feel about their jobs dropped in almost every category over last year’s survey. Many gains in satisfaction at the office between 2008 and 2011 have been wiped out.

“Many will speculate about the reasons for this drop,” Berry wrote, citing an “environment of salary freezes, threats of [government] shutdowns, continued tight budgets, public opinion of government work.”

He said solutions may be “harder to formulate”: While government still attracts talented people committed to public service, “federal leadership must focus on renewing and re-energizing their workforce.” About 687,000 workers responded to the survey, the government’s largest.

Half of the employees surveyed said pay raises don’t depend on performance — the highest percentage to respond that way — and just 22 percent agree that those who do a good job are paid accordingly, grist for critics of a system that can reward longevity more than productivity.

This year’s survey, conducted from April through June, is the most robust and potentially accurate measure to date of how federal employees feel about their jobs. For the first time this year, the census of the workforce was distributed to all permanent full- and part-time employees — about 1.6 million workers — compared with 266,000 in the 2011 sample. About 46 percent responded.

This is also the first time that the survey has been conducted two years running; it had been done every other year since 2002. Federal managers, in theory, use the results to identify problems in the workplace and improve those ­areas where employees are un­happy. The Partnership for Public Service uses the survey to compile its “Best Places to Work” rankings, due for release in December.

While close to 90 percent of employees said the work they do is important, overall their satisfaction with their jobs and their pay, and the likelihood they would recommend their agency to others decreased to 63 percent, the level in 2008. The change came after gains in this area, which showed 67 percent were satisfied in 2010 and 66 percent last year. The same was true of employee engagement, which was 65 percent, down two points from last year.

The survey found a wide variation in job satisfaction among the 82 agencies responding. Fifty-nine percent of employees at the National Archives and Records Administration were happy with their jobs, for example, while 74 percent of workers at the National Aeronautics and Space Administration said they were satisfied.

And 46 percent of employees at the Broadcasting Board of Governors and Department of Homeland Security said their work culture is focused on getting results. The Federal Trade Commission, meanwhile, reported 66 percent.

Telework was a bright spot. One third of the federal workforce is eligible to telework, up from a quarter in 2011, and almost that many said they telework.

Teleworkers reported being generally happier than those who commute daily, the survey found.

The government got new demographic data this year about veterans and disabled and gay federal workers, who were asked to identify themselves for the first time. Gay workers pressed for inclusion in the survey.

About a third of all respondents served on active duty before working in government or during a break in their jobs; 13 percent said they have a disability; and just over 2 percent identified themselves as gay, lesbian, bisexual or transgender.

“To maintain a strong federal workforce, the pay freeze and constant attacks on their jobs and retirement security must end,” Colleen M. Kelley, president of the National Treasury Employees Union, said in a statement.