Making sense of this presidential election requires figuring out what happened in rural places across the country. This is especially true in the Upper Midwest, where there were sharp swings toward Donald Trump that helped produce surprising victories in states such as my home state of Wisconsin.

So what is going on here? A crucial part of the story is what I call “the politics of resentment” — a feature of the rural Midwest that has been brewing for years. It clearly anticipates what happened on the national stage in Tuesday’s election.

Since May 2007, I have been studying this resentment by inviting myself into the conversations of people in dozens of communities across Wisconsin. Groups of regulars in gas stations, diners, churches and other gathering spots have allowed me to listen as they visited with one another. The typical person in these groups was a white, older male, but not exclusively so.

I had not intended to study a rural-urban divide when I sampled the 27 places I had been visiting. But about a year into this project, one thing was inescapable: People in these small communities and rural places deeply resented the two main metropolitan areas of Madison, the state capital, and Milwaukee. I grew up on the northern edge of the Milwaukee metro region, but the depth and the intensity of this resentment surprised me.

Simply put, the people I listened to felt like they were on the short end of the stick. They felt they were not getting their fair share of power, resources or respect. They said that the big decisions that regulated and affected their lives were made far away in the cities. They felt that no one was listening to their own ideas about how things should be done or what needed attention.

They also resented the way resources were allocated. They believed that Madison sucked in all of their taxpayer dollars and spent them on itself or Milwaukee, not on their own communities. They were struggling to make ends meet, and yet all the money seemed to be going to the cities.

Finally, they resented that they were not getting respect. They perceived that city folks called people like them ignorant racists who could not figure out their own interests. To them, urban types just did not get small-town life — what people in those places value, the way they live, and the challenges they face.

Onto this terrain trod Trump. And he found firm footing, just as Scott Walker did in his rise to the governorship. His message was basically this: “You are right. You are not getting your fair share. And you should be angry about it. You work hard, you are deserving, and yet you are not getting what you should. Instead, the people currently in charge are giving some people way more than they deserve. Elect me and I’ll make American great again. I’ll give you back what you deserve and a way of life you are sorely missing.”

For people who were feeling ignored, disrespected and overlooked by the urban elite, the Trump campaign had a strong appeal.

This election has seen a protracted debate about how much support for Trump is rooted in racism. Indeed, much in American politics is, at a very basic level, about race. But to dismiss as racism the views of the people I’ve listened to is to ignore the key role of economic anxiety and resentment toward the white urban establishment. It also misses how racism plagues our cities, not only smaller places.

The rural-urban divide in Wisconsin is in many ways a microcosm of the nation as a whole. Trump may not have known that his message would so vigorously take root in rural America. It very clearly has.

Katherine Cramer is a professor in the political science department at the University of Wisconsin at Madison and the director of the Morgridge Center for Public Service. She is also the author of “The Politics of Resentment: Rural Consciousness in Wisconsin and the Rise of Scott Walker.”