If you’ve ever been to a Donald Trump rally, you’ll notice it doesn’t match the impression left by the media coverage of the president’s base.

Anger, for instance, isn’t the prevailing mood. Hopefulness is more characteristic. But there’s more. There’s something about these rallies that goes beyond politics, and his harshest critics have found it fearful. “Trump has harnessed the kind of emotional intensity from his base that is more typical of a religious revival meeting than a political rally,” liberal religion scholar Reza Aslan wrote, “complete with ritualized communal chants.”

This isn’t unprecedented. At Barack Obama’s 2008 rallies, fans fainted, and those blessed with an Obama handshake pondered never washing that hand again. Obama was more than a politician. He was nearly a religious figure for his base. Something similar is going on with Trump.

And herein lies the best, deepest explanation of “how we got Trump.” Trump’s improbable likeness to a mega-church preacher allowed him to capture the love of a huge swath of the electorate that previously tuned out or voted for Democrats. The people who came to Trump, especially early in the primaries, weren’t really joining the GOP and they weren’t primarily seeking policies. They didn’t even necessarily believe Trump would bring back their jobs. Many of Trump’s earliest and most dedicated supporters were seeking a deeper fulfillment.

They came to Trump seeking what they had lost because they had lost church.

When Trump caught so many political commentators off guard, we looked for an explanation amid the closing factories, but we should have been looking for the closing churches.

And this is a story much bigger than Trump. Trump’s early appeal was his declaration that “the American Dream is dead,” as he put it in his campaign launch. Faith in the American Dream is the weakest where people lack strong religious institutions where they can seek deeper meaning.

♦♦♦

The best way to describe Trump’s support in the Republican primaries—when he was running against the likes of Jeb Bush, Ted Cruz, Marco Rubio, John Kasich—would be: white evangelicals who do not go to church.

Geoffrey Layman, a political science professor at the University of Notre Dame, noticed this during the primaries, writing: “Trump does best among evangelicals with one key trait: They don’t really go to church.”

While writing my forthcoming book,Alienated America, my research assistant Nick Saffran and I crunched some numbers provided by Emily Ekins of the Voter Study Group. We broke down Republican primary voters by church attendance. Among the most frequent attenders—those going more than once a week—Trump got about 32 percent of the vote.

Trump also got a minority of those who simply go once a week. Among those who reported going “a few times a year,” Trump got about half. He got an easy majority (55 percent) of those Republicans who “seldom” attend, and a full 62 percent of those who never attend. That is, every step down in church attendance brought a step up in Trump support, and vice versa. The most frequent attenders were half as likely to support Trump as were the least frequent attenders.

This confirmed what others had noticed. Liberal Peter Beinart wrote for The Atlantic that the GOP electorate has secularized, and that this secularization “helped Trump win the GOP nomination.”

In March, as the GOP field was narrowing down to Trump and Cruz, one Pew Research Center survey found Trump trailing by 16 points among white evangelical voters who attended church weekly, but leading by 19 points among those who do not.

The nuances of this picture shouldn’t be blurred over. It would be wrong to say that Trump’s base was less religious. Ekins, the pollster, divided the GOP electorate into clusters, defined by various traits. There were “Free-Marketeers” and “Staunch Conservatives,” for instance. There was one cluster defined by being non-ideological and being pessimistic about the future. Ekins labeled them the “Preservationists.” This was Trump’s strongest cluster in the GOP primaries, by far.

The Preservationists, Ekins found, were the most likely to say religion was very important to them. They were also the least likely to attend religious services.

This gave an easy and satisfying explanation during the primaries to Christian conservatives put off by Trump and his base: Oh, these are hypocrites, not real Christians.

That dismissive explanation misses the point. We shouldn’t see this as a story of working-class whites slacking off and turning away from God, as much as one of working-class whites finding themselves in places where institutions of civil society—most importantly the church—are drying up.

♦♦♦

Back in the 2008 and 2012 Republican primaries, analysts saw the GOP electorate in two categories: (a) establishment Republicans or (b) Evangelicals. The Establishment types voted for Mitt Romney or John McCain in 2008, and the “evangelical vote” went for Mike Huckabee in 2008 and Rick Santorum in 2012.

It turns out we were all oversimplifying things. That supposedly “evangelical vote” was a combination of two electorates: (1) the evangelical vote and (2) the rural populist vote. The 2016 primaries illuminated this distinction.

In Michigan, for instance, 2012 saw Romney carry the stretch of the state from Ann Arbor to Detroit, while Santorum won most of the rest of the state. Four years later, it was much more complex: Kasich won Ann Arbor, Trump won Detroit and most of the rural counties, while Cruz dominated in the handful of counties around Holland and Grand Rapids, where the Dutch Reformed church dominates.

The best illustration, though, came in Iowa. Look at two rural counties in Iowa, Fremont County and Winnebago County. Fremont is in the bottom left corner of Iowa, and Winnebago is in the middle-top of the state.

Fremont’s median income was just below $53,000, a bit better than Winnebago’s $49,000. In both counties, just about 21.5 percent of the population 25 years or older has a bachelor’s degree of more. Both are rural counties, mostly corn and soy fields.

Huckabee dominated Winnebago in 2008, and Santorum did the same in 2012, both finishing in the 40s percentage wise, with a 20-point-plus margin. Huckabee and Santorum effectively tied Romney down in Fremont County.

Just from the slight advantage in income and the better Romney vote, you would think Fremont was something of an “establishment Republican” county, while Winnebago was a typical rural county.

Checking back after the 2016 campaign shows a different picture.

Up in Winnebago, Trump finished in third place, with only 18.6 percent of the vote. This was Trump’s fourth-worst county in the state, and it was one of only about three dozen in all of America where Trump scored less than 20 percent in the primaries.

Fremont, meanwhile, was Trump’s single best county in Iowa, giving him 42.7 percent of the vote.

Why did Trump do twice as well in rural Fremont as he did in rural Winnebago?

The economic tale, which is not totally wrong, would point to the layoff of 71 workers from Eaton, the automotive parts maker in Shenandoah in late 2015. Trump’s populism and protectionism appealed there.

But that account doesn’t explain enough of the difference. Fremont’s unemployment rate in February 2016 was still only 3.5 percent, below the state average, and below Winnebago County’s 4.1 percent.

There’s got to be another explanation than strictly the material one.

The Association of Religion Data Archives has a telling number. Winnebago is in the top 10 Iowa Counties in religious adherence, while Trump-voting Fremont is in 84th place.

Packed with a handful of overflowing Lutheran churches, Winnebago is a little Norway on the plains—35 percent of the county claims Norwegian ancestry (another 35 percent are German). Buffalo Center boasts Bethlehem Lutheran Church. Lake Mills has Salem Lutheran Church and Winnebago Lutheran Church. For the Evangelical Lutheran Church in America, Winnebago County is the densest county in the country, according to ARDA.

Things look different down in Fremont County.

“Memorial Baptist Church Closes its Doors,” blared the headline in the Valley News, in Fremont’s county seat of Shenandoah, on October 13, 2013. A year later, the story in the Valley Newswas similar. “Locust Grove Methodist Church, located about 13 miles southwest of Shenandoah, voted to begin the process of closing and abandoning the church. Pastor Buck Buckham said there just aren’t the funds and members available to keep churches afloat in these times.”

In 2016: “Sunday, June 26 will be the final service for the Norwich United Methodist Church located east of Shenandoah on Highway 2.”

This correlation generally holds up across Iowa. While there are no great county-level measures of church attendance, and so we need to rely on ARDA’s adherence numbers, the higher the religious adherence, the lower the Trump vote. The correlation is far stronger when you focus on the more rural counties. Exclude the 10 most populous counties in Iowa, and look at the 89 least populous. Among those, differences in median weekly wages explain about 2.4 percent of the variation in the Trump vote, while religious adherence explains about 10.5 percent of the variation. If we could track attendance, the correlation would probably be much stronger.

Control for education a bit you see an even stronger negative correlation between religious adherence and Trump vote—when you exclude the 10 most educated counties in Iowa, the predictive value of religious adherence more than doubles. With this control in place, about 13 percent of the variation in Trump vote in the Iowa caucuses can be explained by differences in religious adherence.

This suggests that the two things that reduced Trump support in Iowa’s caucuses were (a) education, and (b) living among a critical mass of Christians.

And Trump’s single worst county in all of Iowa—far worse than Polk County (where Des Moines is) or Story County (home to Iowa State), or Johnson County (University of Iowa)—was Sioux County. Trump finished fourth place there, behind Ben Carson. Ted Cruz won every precinct of Sioux County.

Sioux is home to Orange City and Sioux Center, and it is the Dutchest county in America. Dutch ancestry is probably one of the best proxies the Census has for religious attendance.

Jordan Helming, a transplant whom I met at a Jeb Bush rally in Sioux Center, was astounded by the religiosity of the place, including the sheer number of churches. “There are 19 of them in this town—a town of 7,000 has 19 churches.”

Different strains of Reformed Christianity dominate in this overwhelmingly Dutch county, from austere old-world Calvinism (“the frozen chosen” they call themselves) to more evangelical flavors. Attendance (often twice on Sundays) is high, and the churches build strong community bonds.

“You care about your neighbors,” Helming explained, “you care about your environment, but you also take care of it yourself—don’t rely on the government.”

A New Yorkerprofile of Orange City characterized the pitch the locals make to potential residents: “When you have children, we’ll help you take care of them. People here share your values, it’s a good Christian place. And they care about you: if anything happens, they’ll have your back.”

The devout and close-knit Norwegian and Dutch pockets on the Great Plains had a larger echo in the Mountain West—the Mormons. Not counting D.C., Trump’s second worst state in the primaries was Utah. His biggest drop-off from Romney was in Utah. Utah tops all measures of religiosity, and not coincidentally it also tops most measures of happy, well-adjusted lives.

Utah boasts the highest rate of upward mobility. It tops the charts in terms of intact families and measures of social capital. Various measures of the “happiest state” all put Utah at or near number one.

Again, the Trump vote in the early primaries seems to be inversely correlated with belief in the American Dream.

The most Mormon county in the U.S., however, is not in Utah, but is Madison County, Idaho, home to BYU Idaho. Trump’s share of the primary vote there: 7.6 percent, making the most religious county in America Trump’s worst county in the primaries.

The more people worshipping and studying with neighbors with whom they shared a higher cause, the less belief that the American Dream was dead.

♦♦♦

Buchanan County is in Virginia, but it borders on West Virginia and Kentucky. It’s Appalachia. In April 2016, Buchanan County earned the distinction of “The Place that Wants Donald Trump Most,” as a Wall Street Journalheadline put it. After 32 states had held their Republican primaries, Buchanan stood out as Trump’s best county, with 69.7 percent of the vote there.

Among the 3,143 counties in the U.S., Buchanan ranks 3,028th in religious adherence, according to ARDA. Only 25 percent of the county declares any religion, compared to 50 percent in the median U.S. county. Even more striking, in the counties that make up Appalachia, is the low attendance.

“These people,”said J.D. Vance, author of Hillbilly Elegy, “despite being very religious and having their Christian faith as something important to them, aren’t attending church that much. They don’t have that much of a connection to a traditional religious institution.”

Buchanan County, Virginia, like Fremont County, Iowa, has suffered economically, and so it’s easy to chalk up the pessimism and the Trump support to those economic hard times. But it’s an inadequate explanation when you put the economic struggles in perspective.

Fremont’s unemployment was below 4 percent when it went for Trump—lower than the national rate today. Buchanan County’s 11.8 percent in 2016 is much higher, but go back a few years, and you’ll find hundreds of counties around the country doing far worse.

Economic collapse goes hand in hand with the desiccation of religious institutions. When factories or coal mines close, some portion of the population flees. Still others stop going to church—white Americans are less likely to attend religious services when they are unemployed, sociologist Brad Wilcox reported ina study titled “No Money, No Honey, No Church.” A church built for a few hundred families has trouble maintaining itself when a third of them leave.

Absent strong job prospects, fewer adults form families. When people have fewer weddings and christenings, and fewer kids to educate on right and wrong, they go to church less. Of course then, this becomes a vicious circle: in communities less anchored in church, there’s less family formation. A place with fewer families is a place less attractive to employers—thus this social and moral collapse is both a consequence and a cause of economic collapse.

The “economic anxiety” is inextricably tied with the collapse of church and family. The latter is the more dangerous problem.

♦♦♦

If you are enmeshed in strong institutions—if you live in a close-knit neighborhood, are rooted in a small town like Orange City, belong to a strong congregation—you may notice how much higher the trust is. Kids leave their bikes on the front lawn. You don’t fret if you show up without a ride home arranged, as someone there will take care of you. You don’t keep a ledger of favors you do, because reciprocity is the norm, and you’re confident you’ll receive back about as much as you gave out.

Social trust is an immensely valuable asset. Increasingly, it’s a luxury good that is abundant only in elite neighborhoods and strong religious institutions. Low trust is a condition of the white working class. Charles Murray, in Coming Apart, reported that white-collar Americans were twice as likely as blue-collar Americans to say “people can generally be trusted.”

Sure enough, low trust helped to predict Trump support in the early primaries. The core group of Trump voters in the GOP primary—the “Preservationists” identified by pollster Ekins—when asked whether “most of the time people try to be helpful, or… they are mostly just looking out for themselves,” were by far the mostly likely to say people mostly just look out for themselves.

In elite family-filled suburbs where most people have college degrees, trust actually tends to be high, regardless of stereotypes about gated driveways. Where do we find trusting middle-class or working-class communities? Where most people go to church.

And when the churches start emptying, the trust starts shrinking. Researchers Margaret Brinig and Nicole Stelle Garnett looked into what happened where Catholic schools shut down for reasons that didn’t appear to be low attendance. Maybe the pastor was transferred and not replaced. Maybe the building had to be demolished. These neighborhoods, shortly after the school shut down, saw increases in public drinking, drug dealing, and drug use. Graffiti, litter, and abandoned buildings became more prevalent.

In such neighborhoods, after the shut down, people were less likely to agree that “people around here are willing to help their neighbors,” or “this is a close-knit neighborhood,” or “people in this neighborhood can be trusted.”

“[R]eligious Americans are, in fact, more generous neighbors and more conscientious citizens than their secular counterparts,” wrote Robert Putnam and his coauthor David Campbell in American Grace, a church-centered follow-up to Bowling Alone.

Most importantly, trust is simply higher in places where more people go to church. “[T]he average American has more trust in ‘people who are deeply religious,’” Putnam and Campbell reported. Also, “religious people themselves are most trusting of just about everybody than are secular people.”

The main determinant in all of religion’s benefits, the authors found, was not depth of belief, but frequency of attendance.

The secularization of America is eroding trust. The elites’ replacements for church are strong public schools, country clubs, travel sports teams, and so on. The working class and middle class, it seems, lack those secular institutions of civil society, particularly after the core institution, church, dries up.

It’s got to be a bitter irony for the secular Left. They cheered as they saw Americans turning away from church. But when Middle America turned away from church, they were missing something. And they sought it in Trump.

Timothy P. Carney is commentary editor of the Washington Examiner and author of Alienated America: Why Some Places Thrive While Others Collapse.