Today, YMCA-run gyms span the United States, serving millions of people. You might wonder why a faith-based organization would be running gyms at all, but ”The Y,” as it has rebranded itself, got its start in the workout biz thanks to a late-nineteenth century philosophy known as “muscular Christianity.”

This movement, which linked physical prowess with a strong faith and morality, “represented Protestant men’s response to changes throughout the nineteenth century,” writes scholar Irén Annus. These men were responding to a number of developments, she writes, such as “the growing public presence of women” in the temperance movement and the push to get women the vote, as well as the influx of immigrants who worked stereotypically masculine labor jobs while middle-class white Anglo-Saxon Protestants increasingly lifted pens.

One of the ways this anxiety manifested was in a renewed focus on fraternal organizations, she writes, “including the Freemasons, Young Men’s Christian Association and Boy Scouts, in which men succeeded in reconstructing an aura of masculinity for themselves.”

The Victorian idea of Christianity suggested that men had to be strong in order to fight for and physically represent the dominance of their religion and its ideals. This was true in England, where the first-ever YMCA opened in 1844, as well as in America. In Boston, on this day in 1851, the first American YMCA opened, offering “a safe gathering place, opportunities for socializing, bible-study classes and prayer meetings,” according to its official history. It quickly moved to a larger premises that included a reading room, a gym and “classes and lectures.”

By the 1880s, American YMCAs were placing greater emphasis on the physical education and “bodybuilding” part of their mandate. In fact, the Boston YMCA’s first physical education program director, Robert J. Roberts, coined that term in the late 1870s, writes Northeastern University.

“Roberts’ muscles were as developed as his vision for the YMCA,” writes the university. “His chiseled back could be seen on advertisements for the YMCA’s gym.”

Although physical strength and social resources such as those offered by the YMCA weren’t in themselves negative things, it is worth noting that the same ideals that shaped the organization had terrible effects elsewhere. The idea that “waves of supposedly ‘less fit’ immigrants threatened to inundate the Anglo Saxon culture” of America had huge power at this time, write Michael Perelman and Vincent Portillo for Counterpunch. These anxieties gave power to the eugenics movement that sought to control “unfit” people–a kind of thinking that dramatically culminated in the Holocaust.

“Sports offered the supposedly genetically blessed elite young men an opportunity to display their potential as natural leaders,” the pair write. “In effect, muscular Christianity was intended to produce the kind of leadership that aristocrats had historically exercised, especially in times of war.”

The Y isn’t the only modern organization that has these roots–they are shared with the Olympics, the modern Girl Scouts and Boy Scouts, with college football and with beauty pageants. While their ideologies have changed since their beginnings, it’s worth remembering the ideas that gave these organizations their start.