Both Republicans and Democrats are facing dramatic long-term realignments in the religious composition of their base, and it will be a challenge for the parties to weather this shift gracefully.

Glance at the data from a new report from the Public Religion Research Institute (PRRI) and you’ll see why doubling down on white identity politics could be a winning strategy for President Trump and the Republicans in the short term, but it might not be successful for long. The PRRI report, which is based on a poll of more than 101,000 Americans from all 50 states, makes clear that white Christians, traditionally a large portion of the Republican base, are, as a group, both declining and aging. Younger white Christians are abandoning their churches in droves, leaving behind increasingly middle-aged and elderly congregations.

Democrats, meanwhile, have something of the opposite problem. Their base is increasingly religiously varied, and while this is certainly reflective of where the country is going as a whole, Democrats must craft a message that speaks to pretty much every faith tradition — as well as people who have no religion at all. And young black Protestants and Hispanic Catholics, two groups that have historically been loyal Democratic constituencies, are less likely to affiliate with the party than their parents and grandparents.

So far, having a base that’s composed overwhelmingly of one demographic group hasn’t doomed Republican candidates — white, conservative Christian voters have been the bedrock of the GOP base since the 1980s and helped deliver President Trump to the White House last year. In 2016, a whopping 35 percent of Republicans were white evangelical Protestants, 18 percent were white mainline Protestants, and 16 percent were white Catholics; together, those groups account for nearly 70 percent of the Republican base.

The religious gap between Democrats and Republicans Share of Democrats and Republicans by religious affiliation 2006 2016 REPUBLICANS DEMOCRATS REPUBLICANS DEMOCRATS White evangelical Protestant 37% 17% 35% 8% White mainline Protestant 22 16 18 11 White Catholic 20 16 16 10 Mormon 2 1 4 1 Black Protestant 2 18 1 17 Hispanic Protestant 3 3 3 4 Hispanic Catholic 3 8 3 10 Other Christian 5 6 5 6 Jewish 1 3 1 2 Other world religions 1 2 1 3 Unaffiliated 4 9 11 26 “Other world religions” includes non-Western religious groups such as Muslims, Buddhists, Hindus, Sikhs and Jains. “Other Christian” category is composed of ethnic Christians (such as Asian Christians, mixed-race Protestants, black Catholics) and other Christian religious groups like Jehovah’s Witnesses. SOURCE: PRRI 2016 American Values Atlas, Pew Research Center

But since 2006, the proportion of Americans identifying as white evangelical Protestant, white Catholic, and white mainline Protestant have all dropped by 5 or 6 percentage points, according to the just-released PRRI report.

“Republicans will have to widen their net to attract more supporters who aren’t white Christian — in the long run, they just won’t have a choice,” said Daniel Cox, director of research at PRRI. White evangelical Protestants and white Catholics have the highest median age — 55 — of any religious group, with white mainline Protestants following close behind at a median age of 54. And the median age of people who don’t identify with any religion (also called the “religiously unaffiliated”) is rising, which suggests that people who have left their faith tradition aren’t returning to the fold as they get married, start families or hit other major life milestones.

So where are these young people going? The religious groups with the youngest membership map neatly with the Democratic Party’s coalition. Religious minorities like Muslims, Hindus and Buddhists; the religiously unaffiliated; and Hispanic Protestants and Catholics all have significant numbers of followers under the age of 30. And all of these groups disproportionately identify as Democrats.

This youth and diversity might seem like a gift to the Democratic Party, but it also presents a serious challenge for politicians hoping to present a compelling vision to voters who have a wide range of values and priorities. White Christians, especially white evangelical Protestants, have been a political powerhouse for the Republicans because of their enthusiasm and ideological unity. The religiously unaffiliated, according to the PRRI report, now constitute more than one-quarter of the Democratic base. “It’s really hard to find a message that speaks to someone who’s not religious at all and a devout Catholic or evangelical Protestant,” Cox said. “The danger for Democrats is that they don’t find ways to motivate all of these diverse groups, and those voters just stay home.”

And the religiously unaffiliated — a plurality of whom don’t consider themselves part of any political party — are also less politically engaged than other religious groups and less likely to vote. “That’s partly because they’re younger,” Cox said, “but also because they’re not attached to formal institutions like churches.” Those institutions — especially churches — have been key for unifying voters around shared values and issues, and for motivating them to vote, according to Cox.

There’s also evidence in the report that young religious voters of color in particular may feel less loyalty to the Democrats than older generations did. Only 35 percent of Hispanic Catholics under the age of 30 identify as Democrats, compared to 56 percent of Hispanic Catholic seniors. Similarly, just 58 percent of black Protestants under 30 say they’re Democrats, compared to 79 percent of black Protestants over the age of 65.

Cox cautioned, though, that political affiliation tends to solidify over time, with young people often identifying as independents in their twenties but choosing a party affiliation as they grow older. And although the number of people who identify as political independents has been rising in recent years, most independents also lean toward a party, which means the balance of party affiliation may not be shifting as much as it seems. However, other polls have shown that millennials have some of the highest levels of political and religious disaffiliation of any generation in years, so it’s unclear if that pattern will apply to them as they grow older.

It’s important to remember that demographic changes don’t manifest overnight. White mainline Protestants, for example, have been steadily hemorrhaging members for decades, but they still account for a sizeable chunk of the country’s religious landscape. Younger voters — especially the religiously unaffiliated — tend to hold liberal views on cultural issues like same-sex marriage, abortion and the legalization of marijuana, Cox said, but strong conservative positions on these topics still reliably drive conservative white Christians to the polls.

That dynamic is perhaps the thorniest challenge for politicians looking to embrace younger generations’ changing values: Both major parties, but especially Republicans, will have to continue to appeal to their traditional voter base while the country slowly shifts around them. “It’s not like we’re going to wake up tomorrow and say, ‘Oh my goodness, we live in a different country,’” Cox said. “But 20 years from now, it’s going to seem like it was inevitable.”