More than 22 million Americans are government workers. While the ideal size of government in the United States is a matter of intense debate, most Americans agree that government workers are necessary in some capacity. Public education, law enforcement, emergency services, and road maintenance are all matters of public administration, and state, local, and federal government employees help these public services run smoothly.

Using data from the Bureau of Labor Statistics (BLS), 24/7 Wall St. reviewed the percentage of each state’s labor force working as local, state, or federal government employees. While nationally, 15.5% of the country’s workforce is employed in the public sector, Wyoming’s public sector accounted for 24.6% of the state’s workforce, the largest share of all states. At just 12.1%, Pennsylvania employed the smallest share. These are states with the most (and least) government workers.

State and local government employees perform a range of tasks to keep a state running properly. Some workers are needed as administrators, while others maintain roads, serve as representatives, and help provide other public goods and services. The vast majority of total government employment in the United States comes from localities, rather than from states or the federal government. Nationally, 12.4% of all public workers are employed at the federal level, 22.9% are employed by states, and the remaining 63.8% are employed at the local level. According to Bureau of Labor Statistics chief regional economist Martin Kohli, the majority of local government jobs are in public education.

Kohli explained that the need for public education and other basic government services, even in the smallest, most rural governments in the country, helps explain why some states have larger concentrations of public employees as a share of total employment. He noted that the need for public administration workers is subject to returns to scale, meaning fewer public employees are needed when populations are all concentrated in one area, and more are needed per capita in places with lower population density.

43.  Michigan

> Pct. workers in government, 2015: 14.0%
> Pct. workers in government, 2005: 15.4% (15th lowest)
> Chg. government workers (2005-2015): -11.8% (2nd largest decrease)
> People per square mile: 174.8 (17th most)

The number of government workers in Michigan declined by nearly 80,000 between 2005 and 2015. While many sectors lost jobs during that time, only the state’s manufacturing sector had a greater total decline. Today, just 14% of Michigan’s workers are employed by the state, federal, or a local government, compared to 15.4% in 2005.

Indeed states with high shares of workers in government include less densely populated states like Montana, New Mexico, and North and South Dakota. The two states where government jobs make up the highest share of the state workforce — Wyoming and Alaska — also have the fewest people per square mile in the country, at just 5.8 and 1.2 people per square mile, while the national population density is 87.4 people per square mile. Very densely populated states like Massachusetts and Rhode Island tend to have relatively small government sectors.

Compared to the private sector, government jobs appear to be more stable on the whole. The number of government workers increased by about 200,000, or 0.9%, over the past decade. During the recession, some states shed hundreds of thousands of private sector jobs, and while many lost public sector workers as well, government positions were relatively stable in many states during the crisis.

Over the past 10 years, while government jobs increased in some states and decreased in others, no state had a greater than 20% increase or decline in public sector employment. Meanwhile, the construction sectors of many states are still down by more than 30%, even after years of recovery.

Kohli explained that there are many potential reasons for the relative stability of government jobs during the recession, but he pointed out that subsidies from the federal government may help preserve public sector jobs while private sector positions are at risk. “There’s a really interesting issue there, back when Mr. Obama took office, and he proposed this economic stimulus bill. And part of that stimulus involved aid to state and local governments.”

Kohli was quick to add, however, that government jobs were by no means immune to the effects of the recession. “It was a long-lasting recession, and the recovery was slow, and it did result in a certain amount of strain on state and local government budgets.” Indeed, government positions in more than five states fell by more than 5% over the past decade, even as the national share of government jobs increased slightly. Kohli gave the example of Rhode Island, where total government employment decreased by 7.1%, likely in part because the state shed jobs as a cost-cutting measure.

To determine the share of each state’s labor force employed in government at the state, local, or federal level, 24/7 Wall St. used employment data from the Bureau of Labor Statistics (BLS) for 2015. The percentage of the population working in a particular industry is relative to the state’s total nonfarm payrolls. State employment-to-population ratios are also from the BLS. Population density, the share of households living in rural areas, median household income, and poverty rates are from the U.S. Census Bureau’s 2014 American Community Survey.

Click here to see the states where the most people work for the government.