For more than four decades, New Hampshire Secretary of State Bill Gardner has successfully warded off challenges to the state’s first-in-the-nation presidential primary, steadfastly enforcing state law that calls for it to be the first on the calendar.
On Wednesday, he fended off his greatest challenge yet — for his own seat.
Gardner defeated an upstart candidate, former executive councilor Colin Van Ostern, by the slimmest of margins — just four votes after two ballots. At the heart of the challenge, Van Ostern’s supporters said, was Gardner’s participation in the controversial commission President Trump created to look into potential voter fraud.
Gardner defeated Van Ostern, the 2016 Democratic nominee for governor, 209 to 205, in a vote by the Legislature. New Hampshire is one of three states where the legislature elects the secretary of state.
“I am very grateful because mostly of the tradition of the secretary of state’s office. That office is so unique and is so special,” Gardner said after winning. “The response from those who have actually done this [the New Hampshire primary] over the years is that New Hampshire has never let us down.”
Congratulating Gardner inside the office Gardner has held for 42 years, Republican Governor Chris Sununu cheered, “Forty more years!”
Van Ostern, 39, was born three years after Gardner, 70, took office.
“Gardner again holding the secretary of state mantle in the Granite State is not without import,” said Josh Putnam, the national expert on the presidential primary calendar and a lecturer at the University of North Carolina, Wilmington. “He literally has been the sole custodian of the first-in-the-nation primary during the post-reform era, a span since 1972 that has seen New Hampshire’s position threatened and successfully protected time and time again.
“Those successes are in no small part due to Gardner’s efforts from his unique perch,” Putnam continued.
The secretary of state vote was arguably one of the most important elections of the year in the state. Even though this was largely an insider contest, the race has dominated the state’s front pages for the past few weeks because of Gardner’s history and the status of the primary.
There was high drama in Concord as the reelection bid for Gardner, the longest-serving secretary of state in the nation, headed to a second ballot.
On the first ballot, Gardner received 208 votes and Van Ostern received 207 — but 209 votes, a majority, were needed to win. One blank or illegible ballot forced a second vote to take place. For 45 minutes, the State House was chaotic with a debate over rules and process before the second vote.
While still respected by the political establishment for his work to defend the primary against other states and national political parties through sometimes wily means, Gardner was challenged because of his participation last year in the Trump commission, which was eventually disbanded amid lawsuits and controversy.
Critics said Gardner gave legitimacy to Trump’s untruthful statements about massive voter fraud in the state, noting that he had hosted one of just two meetings the commission held. Gardner defended his role on the commission by saying, “It’s better to be at the table than on the menu.”
Another member of that commission, Maine Secretary of State Matt Dunlap, eventually sued the group. On Wednesday, Dunlap was unanimously reelected by his own Legislature. Dunlap had sued the Trump commission over its request that Maine send voter data to the federal government, while Gardner found himself on the other end of a New Hampshire lawsuit because he wanted to hand over his state’s data.
Gardner’s involvement in the commission, along with advocacy for a new voter ID law, created an opening for the first challenge against him since 1984.
The election was especially personal. Gardner’s high school teacher, now a state senator, nominated Gardner. Meanwhile, a state representative who attended Gardner’s wedding decades ago nominated Van Ostern.
Van Ostern ran a modern campaign, raising nearly a quarter-million dollars for a contest involving only 424 possible voting members of the Legislature. Gardner supporters, including five former governors, argued that Van Ostern would transform the traditionally nonpartisan office into a “partisan command center.”
State Senator David Watters, a Democrat who supported Van Ostern, said, “I know we all feel the weight of history in this vote . . . but it is time.”
State Representative Ned Gordon, a Republican and former judge, argued that Gardner deserved the respect to at least oversee the 100th anniversary of New Hampshire’s first-in-the-nation primary in 2020.
“I would like to see Bill finish his career gracefully,” Gordon said.
Gardner was first elected to his post in 1976 — winning the first of 21 two-year terms.
During his tenure, Gardner not only enforced a state law that dictated the New Hampshire primary be held at least a week before any similar contest in another state, but he also served as emcee as hundreds of presidential candidates visited his office to officially place their name on the presidential primary ballot.
“In my years in office, I have overseen 500 recounts where 11 ended in a tie and 32 ended up being decided by one vote. I never actually thought of myself ending up in one like that,” he said in his acceptance speech.
James Pindell can be reached at email@example.com. Follow him on Twitter @jamespindell or subscribe to his Ground Game newsletter on politics: http://pages.email.bostonglobe.com/GroundGameSignUp