Donald J. Trump’s rise to the G.O.P. nomination and eventual presidential victory gave heft to the idea that extreme candidates can beat moderates by galvanizing their party’s base. That premise is shaping competitive races in both parties.

But an analysis of more than 30 years of House general elections suggests the opposite.

It seems that when parties nominate an extreme candidate — in a district where a more moderate candidate might have had a chance to win the primary — the extreme candidate does worse in the general election.

Extreme candidates fire up voters, but not always in the way the candidates would like.

A party that nominates an extreme candidate when it could have nominated a more moderate one may lose as much as seven points of vote share in the general election, according to Andrew Hall, a political scientist at Stanford University, and Daniel Thompson, a doctoral student there. Seven points would have been enough to swing dozens of House races in 2016 alone.

Extreme candidates, the researchers say, may mobilize their party’s base — but they tend to activate their opponent’s base even more than their own, resulting in a net loss on turnout. They also seem to lose habitual voters — the people who almost always turn out to vote — to the opposition party, while moderate nominees hold on to those voters. In this way, extreme nominees lose votes in two ways: mobilization and persuasion.