Jennifer, a young mother and member of the Church of Jesus Christ of Latter-Day Saints in northern Virginia, is honest about the challenges of being Mormon in America today. “It’s not an easy gig,” she says. It’s not just the expectation that you will adhere to strict religious standards when it comes to dating and sex. Or the 10 percent tithing requirement. The prohibition on tea, coffee or alcohol. It’s the time, she says. “My husband and I teach Sunday school to 14- and 15-year-old teenagers. On a Saturday night, we might not be kicking back and watching a movie or bingeing Netflix; we’re planning our Sunday school lesson.”

While the structure of the LDS Church, which relies on volunteer leadership at the local level, requires an active membership, there is an upside to the obligations of religious community. In an era marked by unprecedented religious decline, Mormons appear to be holding their own.

One-quarter of Americans are religiously unaffiliated today, a roughly fourfold increase from a couple of decades earlier. Christian denominations around the country are contending with massive defections. White Christian groups have experienced the most dramatic losses over the past decade. Today, white evangelical Protestants account for 15 percent of the adult population, down from nearly one-quarter a decade earlier. By contrast, Mormons have held steady at roughly 2 percent of the US population for the past several years. And perhaps as importantly, Mormons are far younger than members of white Christian traditions.

At one time, sociologists and religion scholars argued that theologically conservative churches, which demanded more of their members, were successful because they ultimately provided more rewarding religious and spiritual experiences. This theory has since fallen out of favor as the tide of disaffiliation appears to be washing over conservative and liberal denominations alike. The Southern Baptist Convention, the heart of conservative Protestantism, has sustained 12 straight years of membership loses. Since 2007, the denomination has shed 1.2 million members.

But more than the rules, rituals, and rigorous theology, the success of the Mormon Church may have to do with their unrelenting focus on the family. Few religious communities have made the development and maintenance of traditional family structures such a central priority. Eighty-one percent of Mormons say being a good parent is one of their central life goals. Nearly three-quarters say having a good marriage is one of their most important priorities in life, and a majority of Mormons — including nearly equal numbers of men and women — believe that the most satisfying type of marriage is one in which the husband provides and the wife stays home.

Mormon emphasis on family strengthens ties

There’s no better illustration of this emphasis than family home evening. The church introduced this officially sanctioned weekly event in 1915 with the goal of strengthening family ties and engaging children in religious and spiritual activities, such as prayer, singing hymns, and reading Scripture. Sociologist Vern Bengtson, author of Families and Faith: How Religion Is Passed Down Across Generations, described family home evening as among the “most successful [religious] programs fostering intergenerational connections.”

It’s no accident that Mormon families tend toward traditional two-parent households with children. A 2015 Pew Research report shows that Mormons are more likely to be married and to have larger families than other Christians. Roughly two-thirds of Mormons are married, compared to only about half (52 percent) of Christians overall.

Even more importantly, Mormons are more likely to marry within their faith than members of most other religious traditions: 82 percent of married Mormons report that their spouse is also Mormon. And Mormon families are large even compared to other Christian traditions, averaging 3.4 children compared to 2.2. children for all Christian households.

The structure of Mormon families is hugely advantageous when it comes to passing along religious identity. Family life has always been a critical source of religious vitality. It is the crucible within which religious identity is formed, rituals are learned and practiced, and beliefs take shape. As societal attitudes about sexual norms drift further from traditional religious norms, and the stigma of non-belief wanes, formative religious experiences are becoming even more important. A generation ago, most Americans who shed their childhood religious attachments did so during their college and post-college years. Today, four in five young adults who report having left their childhood religion say the turning point occurred before they reached age 18, most likely when they were still sleeping under their parents’ roof.

Family dynamics and structure matter in at least two ways. Recent research has shown that when Americans are raised in households with parents of different religious backgrounds, they have weaker attachments to religion as adults and are more likely to disaffiliate. Divorce, which can physically separate young people from their religious community and often creates greater emotional distance between children and parents, has also shown to hamper the transmission of religious values. Because the vast majority of Mormon children are raised in two-parent Mormon households, they are far more likely to receive robust and consistent religious instruction throughout their childhood.

Recognizing the centrality of family, the LDS Church has not been shy about encouraging young Mormons to start families early. In 2005, the LDS Church leadership was actively encouraging college students to start families even before they graduated. More recently church elder M. Russell Ballard urged Brigham Young University students to not let educational goals lead them to postpone marriage. “You can accomplish both with hard work, sacrifice, and planning,” he said. “In fact, with a companion’s support, you can be more successful.” It’s a message that resonates with many Mormon college students.

A recent poll by College Pulse of students currently attending four-year colleges and universities found that the most common response among students about the ideal age to be married was 28. However, the response among Mormon students was 24.

Young Mormons want a more tolerant church

Even with a concerted emphasis on family formation and religious education, there is evidence that an increasing number of Mormons are still leaving the church. The Pew Research Center’s 2014 Religious Landscape Survey found that 64 percent of those raised in Mormon households still identify as Mormon as adults. And while this rate is still better than that of most other Christian denominations, it represents a modest decline from 2007, when the retention rate stood at 70 percent. Jana Riess, author of the upcoming book The Next Mormons: How Millennials Are Changing the LDS Church, argues that younger Mormons are leading the way out the door, at least in part over the church’s hardline stance on LGBTQ issues.

It is an argument that resonates with many younger Mormons. Jennifer struggles with her own feelings about the church’s treatment of gay and lesbian people. “I wished that certain doctrines would have come out differently, and I wished that things had been communicated differently,” she says. Sarah, another young Mormon mother, concedes that the church might be out of step with young people — even younger Mormons — on the issue of same-sex marriage. “A lot of members of the church feel like more love is better and being more welcoming is better,” she says. But there are signs that the church hierarchy is listening.

Quin Monson, a professor of political science at BYU and co-author of Seeking the Promised Land: Mormons and American Politics, says that while the church has maintained its conservative theological stance, it is offering a kinder and gentler approach on hot-button social issues like LGBTQ rights. “It’s a matter of emphasis and how the church talks about social issues,” he says.

In 2016, the LDS Church launched a website called Mormon and Gay featuring firsthand accounts of Mormons who identify as gay, lesbian, or bisexual. Importantly, the church remains opposed to same-sex marriage, but church leaders have adopted much more inclusive language when discussing LGBTQ members of the church. “It shows the church is taking a step in the direction of understanding and empathy,” Monson says.

This shift stands in stark contrast to what is unfolding in the United Methodist Church, which recently voted to toughen prohibitions on same-sex marriage and LGBTQ clergy. The Catholic Church remains similarly steadfast in its opposition to same-sex marriage. The Vatican’s website describes homosexuality as “contrary to the natural law” and claims that “homosexual acts are intrinsically disordered.” The Southern Baptist Convention does not feature the issue of homosexuality or gay and lesbian people prominently. But the denomination’s position on the issue is clear: “Homosexuality is not a ‘valid alternative lifestyle.’”

At the congregational level, members of conservative churches still receive negative messages about LGBTQ people with some regularity. A 2016 Pew Research Center study found that 46 percent of white evangelical Protestants said their clergy had brought up the issue of homosexuality in the past couple of months, and the overwhelming majority of those who reported hearing about the issue said their clergy spoke out against it.

The reasons Americans leave religion are varied, often complex, and incredibly personal. As a result, there is no single tactic that will ensure the vitality of religious congregations in the US. But the Mormon experience is instructive. At a time when the American family is undergoing seismic shifts in structure and function, the church appears to be leaning into its emphasis on traditional family life and roles. However, the church appears much more willing to change its approach and rhetoric, if not theology, when it comes to LGBTQ members.

Every religious congregation in the US will have to make the same bet about which traditions and practices are inviolable and which are not, where to bend, and where to hold firm. Time will be the ultimate arbiter as to whether the Mormon Church got it right. Bengtson’s study provides a reason to think Mormons may be successful in their fight against religious decline. Among the 350 families he studied, no religious group was more effective in passing on their religious identity and beliefs to their children than Mormons.

Correction: The Mormon Church lifted its ban on caffeinated soda in 2017, but still prohibits the consumption of tea and coffee.

Daniel Cox is a research fellow in polling and public opinion at the American Enterprise Institute (AEI), where he specializes in survey research, politics, youth culture and identity, and religion. Before joining AEI, he was the research director at the Public Religion Research Institute, which he co-founded, and where he led the organization’s qualitative and quantitative research program.