Partisanship is a dirty word in American politics, especially among the young. Nearly 50 percent of millennials consider themselves independents, far higher than any other demographic. And 18- to 29-year-olds who are more hostile to the parties are less likely to vote.

But positive partisanship once enticed young Americans. From the 1830s through 1900, parties organized youth clubs in smoky saloons and threw massive midnight “jollifications,” attracting millions to active involvement. Political parties were the most popular institutions in American life, offering surprising solutions to the challenges of adolescence in an adolescent nation.

Their success suggests that America might not need less partisanship today—perhaps it needs more.

Sixteen was a tough age for Benjamin Brown Foster. There were few good jobs in his antebellum Maine lumber town. Bosses cheated him, girls mocked him, and rich kids snubbed him. He spent most of his time reading Edgar Allen Poe, dabbling in phrenology, and filling his diary with neurotic worries, moaning “I am learning nothing, earning nothing, doing nothing.”

There was one bright spot: party politics.

Though he was too young to vote, Foster looked forward to the 1848 presidential election, where he hoped to “advance a boy’s opinion” in favor of the new antislavery Free Soil Party. Nothing else in his stifled life drew “so much interest and excitement.” Foster considered party spirit to be one of the nation’s greatest gifts—“the cement of the union, America’s salvation.”

Parties drove political life in the 19th century. They published the newspapers, printed the ballots, and organized the campaigns that pushed voter turnout over 80 percent. And they blurred the line between political organizations, focused on governing, and cultural institutions, with distinct identities, ethnicities, and fashions. The British actress Fanny Kemble joked, in 1833, that for the average American, party identity was “as inseparable from him as his clothes.”

From children to 20-somethings, young people were considered the most wildly political Americans. The Newark Evening News declared the “great majority” of school-kids “violent little partisans,” who hollered nasty rhymes at rivals (“Democrats eat dead rats” was a favorite). Many youths joined political marching clubs—girls dressed as goddesses, boys in military uniforms, wielding torches, playing brass instruments, sometimes concealing bowie knives or revolvers. And so-called “virgin voters” turned out on Election Day, excited to cast their first ballots for their beloved parties.

These young people did not just happen to be Democrats or Republicans. It was often their most important, lifelong identity. Many inherited their politics as children, like the Ohioan who joked “I wuz born a Whig.” And over 90 percent stuck with their families’ party in each election. As one former slave in Arkansas told interviewers, well into the 20th century, “I am a Republican. I ain’t going to change. That’s my party till I dies.”

Young people needed these parties. America was expanding at an incredible rate, growing from 5 million to 75 million in a century, while the industrializing economy boomed and busted, hitting young workers the hardest. The emerging society had little interest in the old rites of passage that had ushered youths into adulthood in Europe or Africa. Instead, young people found themselves adrift between tradition and modernity, agriculture and industry, childhood and maturity.

Benjamin Brown Foster felt this. He struggled to win an apprenticeship, as low-skilled industrial labor disrupted that tradition of mentorship. He yearned for a romantic relationship, but had difficulty adapting to the widening world of 19th-century courtship, with so many more partners and a climbing marriage age. (The fact that he was, honestly, quite funny-looking did not help). He felt pushed by the progress-focused modern world, but moaned: “My life is already probably a quarter or a fifth gone and with what result?”

And Foster was typical, representing 19th century America’s angsty, ambitious youths. William Dean Howells, the future Atlantic Monthly editor, sounded very similar concerns 10 years later and 800 miles west. Though he aspired to “to make money, and be rich and grand,” 20-year-old Will Howells whined “I am proud, vain, and poor … I pronounce myself a mistake.” The great uncertainties of 19th century life left millions scribbling anxiously in their diaries.

Political parties offered a kind of scaffolding, stabilizing their lives. Foster might not have a steady career or a regular girl, but he had the Free Soil Party, with its lectures by fugitive slaves, reading rooms packed with aggressive newspapers, and thrilling torch-lit rallies. Partisanship was an immensely doable identity for stalled 16-year-olds, promising a sense of action and agency.

These parties met needy young people where they were. For those on a “wander year,” aimlessly tramping across the country, national parties offered a familiar organization from Maine to Texas to Oregon. For men and women more concerned with courting, party events offered youths a chance to flirt. There were plenty of young couples “making love” at political picnics—embracing, kissing, and cuddling. And out-of-work b’hoys, loafing in saloons and drug stores, found that the parties always needed more canvassers arguing politics over a lager or a bourbon.

Elite politicians worked to make their parties popular with what Lincoln called “the shrewd wild boys.” Each organization insisted, baselessly, that theirs was the true “party for young men.” But while praising young supporters as pure and honest, they also hissed that anyone who switched parties was – in the words of one author of advice books for young gentlemen and ladies – “a most despicable character; unworthy the privileges of a freeman.”

Inflexible partisanship actually made young voters extremely valuable to politicians. Because so few older Americans would switch parties, campaigners had to constantly find new first-timers. It was the only reliable way to grow a 19th-century party, so elite politicians focused on the “army of younger brothers” feeding into the system every four years.

For 1840 to 1900, youth-focused parties sustained a political system that was popular and unequal, grassroots and top-down, deeply felt but shallowly reasoned. And then, around 1900, public interest crumbled. Nearly 80 percent of eligible voters had turned out in 1896, but fewer than half bothered by the 1920s. Young voters led this exodus. Old partisans kept turning out, committed to the movements that had won their virgin votes, but fewer young men (and women, after 1920) showed interest in casting their first ballot.

The adolescents of the 20th century needed partisanship less. Young people could turn to schools, unions, and an enveloping teen culture when looking for stability and identity. By 1909 Jane Addams, the famed social activist, wrote that public life “no longer stirs the blood of the American youth.” Young people had so many other options, from high school to Hollywood, to help them grow up.

Today, many of those stabilizing institutions of the 20th century seem to be faltering. And young people without ties to organizations are the most adrift, and the least likely to vote. Those with strong community bonds—often wealthier, college-educated, more likely to be female than male—tend to vote at relatively high levels. Isolated working-class young men, with few institutions in their lives, are the least politically involved.

Partisanship is easy to attack, but positive party identity was once crucial to young Americans facing an uncertain world. And while our current hostility toward political parties is not baseless, the chaotic 2016 campaign exposes some of the dangers of weak political institutions, not overbearing ones. Moving forward, Americans might acknowledge that partisanship has been a crucial tool, stabilizing adrift populations, organizing a segmented nation, and restraining a democracy with some dark tendencies.