When it comes to electoral strength, is demography destiny? Leaders of both major political parties often seem to think so.

Republicans in North Carolina and across the country have enjoyed significant success in recent elections in part because older voters are the group most likely to cast ballots — especially in midterm election cycles — and have become more likely than not to vote for GOP candidates.

Republicans expect to continue to benefit from this trend as older voters form an increasing share of the electorate. For example, as demographer Rebecca Tippett of University of North Carolina at Chapel Hill has pointed out, our state is currently projected to gain nearly two million new residents by 2035, taking North Carolina’s population to about 12 million. Nearly half of them, 910,000, will be 65 years old or older. By that year, then, the elderly will constitute more than 21 percent of the state’s population, and a much higher percentage of the state’s likely voters.

Surveying this political landscape, Democrats in North Carolina and across the country console themselves by arguing that Millennials are a large voting bloc and lean leftward. Over time, they will deliver more and more electoral victories for Democrats, the argument goes.

The relationship between age and voting behavior is fascinating. It’s also complicated. While some opinions that voters form when they are young tend to stick with them throughout their lives, other opinions change as they experience such life changes as starting a family, buying a house, or paying more than a trace amount of income taxes.

During a recent speech before the North Carolina Free Enterprise Foundation, Tippett cautioned against treating projections as if they were bankable reality. For example, at the time of the 2000 census, demographers expected North Dakota and the District of Columbia to be America’s population laggards. Instead, the fracking revolution and the expansion of the federal government after the September 11 attacks helped make those two places among America’s fastest-growing in population.

When it comes to predicting the political future, humility is in order. Republicans ought not to assume they will always carry older voters by large margins. Democrats ought not to assume they will always carry Millennials by large margins. Circumstances could change. Issues or personalities could emerge that scramble the deck.

That relatively small shifts in electorate composition or behavior can produce different election outcomes became obvious in the 2016 election in North Carolina. Voters under the age of 45 constituted 44 percent of North Carolina’s vote, while those 45 and over made up 56 percent. In the top three statewide races, Democrats won the younger group by a sizable margin and Republicans won the older group by a sizable margin. Yet Pat McCrory narrowly lost his reelection bid for governor even as Richard Burr and Donald Trump won their respective races.

What made the difference? Burr and Trump each won 57 percent of the vote in the older voting group (aged 45 and up), while McCrory’s margin dipped slightly to 56 percent. On the other hand, among the younger group of voters, Democrat Roy Cooper won 57 percent for governor. But Hillary Clinton won those voters by only 52 percent. Senate candidate Deborah Ross won them by just 51 percent.

Cooper prevailed. Clinton and Ross didn’t. As you can see, this was less about differing preferences among older voters than it was about younger voters who split their tickets (including Cooper voters who opted for Libertarian Gary Johnson for president, as Trump actually did no better among younger voters than McCrory did).

Rather than extrapolating a few statistical trends into the future and then waiting for political prizes to fall into their laps, successful candidates and parties will take nothing for granted. They will mobilize their partisan bases, to be sure, but they won’t ignore the critical work of finding cost-effective ways to reach and persuade swing voters to come their way.

Yes, demography matters. But it is no substitute for the thoughtful practice of politics.

John Hood is chairman of the John Locke Foundation and appears on the talk show “NC SPIN.” You can follow him @JohnHoodNC.