There is a battle raging quietly for the soul of the baseball Hall of Fame, one that has pit small-hall advocates against big-hall ones; the writers who have been the Hall’s primary gatekeepers for more than 80 years against the committees empowered to right the writers’ wrongs; and voters who see themselves as Cooperstown’s last line of defense to keep steroid users out vs. those for whom the thought of serving as baseball’s morality police is nonsensical.

But even amid all the chaos and debate, there are players who rise above the vitriol — whose candidacies and reputations are beyond reproach — and chief among them is Mariano Rivera.

On Tuesday, Rivera, the great ex-closer for the New York Yankees, became the first player in history elected unanimously to Cooperstown on his first try. Every last one of the 425 votes cast by 10-year members of the Baseball Writers’ Association of America had Rivera’s box checked, giving him a distinction — unanimity — that every other baseball great, from Babe Ruth to Ted Williams to Ken Griffey Jr., couldn’t manage. Griffey had come closest, landing 99.3 percent in 2016 to fall three votes shy.

“This was just beyond my imagination,” Rivera said on a conference call with reporters. “Just to be considered a Hall of Famer is an honor, but to be unanimous is just amazing.”

Rivera, a 13-time all-star and the sport’s all-time saves leader, heads a four-player contingent elected to Cooperstown. He was joined by two-time Cy Young Award winner Roy Halladay, the late ace of the Toronto Blue Jays and Philadelphia Phillies; longtime Seattle Mariners designated hitter Edgar Martinez, one of the most feared hitters of the 1990s; and former Baltimore Orioles and New York Yankees ace Mike Mussina, who won 270 games despite spending his entire career pitching in the loaded American League East.

Boswell: Mike Mussina won with elegance and consistency. He’s a well-deserved Hall of Famer.

Halladay, who died in 2017 after his single-engine plane crashed off the coast of Florida, received 363 votes (85.4 percent) on his first appearance on the ballot. Martinez, in his 10th and final appearance on the ballot, also was named on 363 ballots. Mussina, in his sixth year on the ballot, was named on 326 ballots (76.7 percent), getting over the 75 percent threshold required for election by seven votes.

The quartet will be inducted — along with closer Lee Smith and designated hitter Harold Baines, elected last month by the Today’s Game Era committee — in a ceremony July 21 in Cooperstown, N.Y.

Among those falling just short — again — were Roger Clemens and Barry Bonds, arguably the best pitcher and hitter of their era but two of the players most associated with the so-called steroid era. Both were on the ballot for the seventh time but gained only modestly from a year ago, with Clemens named on 253 ballots (59.5 percent) and Bonds on 251 (59.1 percent). Both will have three more shots before falling off the writers’ ballot.

This year’s bountiful election comes on the heels of last year’s four-player election (Chipper Jones, Vladimir Guerrero, Jim Thome and Trevor Hoffman) and extends an unprecedented, six-year burst of expansion of Cooperstown’s rolls.

In 2013, when some of the most prolific hitters and pitchers in baseball’s modern history hit the ballot for the first time, voters did something they hadn’t done since 1996: They failed to elect anyone. The reaction was swift and effective. The Hall of Fame purged dozens of older and inactive voters. A voter base that suddenly skewed younger increasingly applied sabermetric tools to players who played before those tools existed, electing previously overlooked players such as Tim Raines (in 2017).

And players once shunned for their connections — real or rumored — to PED use during their careers began climbing toward the 75 percent cut-off, in some cases getting above it.

The large-hall folks won in a landslide over the small-hall proponents. Starting in 2014 and including Tuesday’s announcement, BBWAA voters have sent 20 players to Cooperstown, with the veteran’s committee electing four more (plus five former managers and executives).

The elections of Mussina and Martinez completed stunning comebacks; they received just 20.3 percent and 36.2 percent support on their initial appearances on the ballot (2014 for Mussina, 2010 for Martinez). Neither has struck out any more batters or launched any more homers in the ensuing years, but their vote totals steadily grew. Their candidacies may not have changed, but the electorate did.

Both players benefitted from the deeper scrutiny of advanced metrics. In the case of Mussina, the initial viewpoint of him as perhaps the fifth- or sixth-best starter of his era — behind Greg Maddux, Randy Johnson, Pedro Martinez, Clemens and, depending on your viewpoint, John Smoltz and/or Tom Glavine — appeared to make him a longshot to gain enough support for induction. But Mussina’s case was soon taken up by the sabermetrics crowd; his 3.68 career ERA may not have looked like much on its own, but context-dependent stats such as ERA+ and Wins Above Replacement shed new light on a pitcher who spent his entire career pitching in the brutal AL East.

“I appreciate people staying with me and doing the research, and feeling I’m deserving of this honor,” Mussina said. (He was noncommittal when asked whether his Cooperstown plaque should feature an Orioles or Yankees cap.)

Halladay will be the first first-ballot Hall of Famer to go into Cooperstown posthumously since Christy Mathewson in 1936. (Roberto Clemente, who died in a 1972 plane crash, was elected in a special vote for which the typical five-year waiting period was waived.) A workhorse who led his league in complete games seven times, Halladay also threw only the second postseason no-hitter in history. His death shocked the sport, particularly after toxicology reports showed he had amphetamines, morphine and an insomnia drug in his system at the time of the crash.

This election, though, will be remembered as the one in which someone finally made it to Cooperstown without a dissenting vote. And it was somehow fitting that it was Rivera who did it. There are few players in baseball history of whom it can be said unequivocally that he was the best ever at his position, but Rivera certainly qualifies.

With his regal presence, calm demeanor and quiet lethalness on the mound, Rivera always rose above the banalities of his era. Armed with little more than one magical pitch (his trademark cutter) and an assassin’s nerves, he plied his craft during the peak of the steroid era, in the suffocating heat of the Yankees/Boston Red Sox rivalry — but always seemed better than all of it, both as a pitcher and as a human.

But even Rivera may have benefitted from the changing methodology and infrastructure of today’s Hall of Fame voting process, as the spreading influence of analytics and the presence of online ballot-trackers — which tabulate on spreadsheets the votes of every publicly revealed ballot — promote a sort of groupthink, with nonconforming voters shamed mercilessly on Twitter.

It’s not that Rivera didn’t deserve unanimous election — but did he deserve it more than Griffey (99.3 percent), Cal Ripken Jr. (98.5), Tom Seaver (98.8), Willie Mays (94.7) or Stan Musial (93.2), just to name a few, from the past 50 years of balloting?

For those who missed the 75 percent cut this time — a group that includes Clemens, Bonds, Curt Schilling (60.9), Larry Walker (54.6) and Omar Vizquel (42.8) — there is good news: Next year’s list of eligible players includes only one lock: Derek Jeter, Rivera’s longtime teammate who also could see unanimous election. And the Class of 2021, headed by Torii Hunter, Tim Hudson and Mark Buehrle, features no sure-fire electees.

With the logjam of strong candidates having been loosened by eight players gaining election via the BBWAA in the past two years — and with the examples of the long, steady climbs of Mussina and Martinez fresh in the minds of voters — there is every reason to think some of the players listed above, including Clemens and Bonds, will soon find their way to Cooperstown.

The big-hall voters have won. The only question: How big of a Hall do they want?