CONCORD, N.H. (Reuters) - The New Hampshire official who protects the state’s traditional role in kicking off U.S. presidential elections narrowly held on to his seat on Wednesday, weathering his toughest challenge in four decades in office.

Slideshow ( 6 images )

After hours of debate, state lawmakers reelected Secretary of State Bill Gardner to his post by a vote of 209 to 205. The unprecedented opposition to Gardner arose amid a wave of disapproval of U.S. President Donald Trump, a Republican, which helped Democrats regain majorities in both chambers of the legislature in November’s elections.

While Gardner, 70, is a Democrat, he drew the ire of many in his party over his participation in Trump’s voter fraud commission, which was disbanded in January amid criticism that it had gathered scant evidence of fraudulent voting.

Gardner has served as defender of the state’s first-in-the-nation presidential primary since 1976, the year Democrat Jimmy Carter and Republican Gerald Ford won the match-up.

“I would like to see Bill finish his career gracefully and be in office for the 100-year anniversary of the primary, which he has worked so hard to protect and which has so benefited New Hampshire,” said state Representative Ned Gordon.

Gardner’s critics argued that he was tainted by his association with Trump’s voting panel.

“Many of us are sitting in this room today because the voters said no in thunder to reject attempts to limit voting rights,” said state Senator David Watters, a Democrat.

Democrat Colin Van Ostern, a failed gubernatorial candidate, mounted a well-funded public campaign against Gardner, a first in New Hampshire politics.

New Hampshire’s nominating primary, where each party selects its candidate, is by tradition the second major contest in U.S. campaign seasons after Iowa’s caucus.

It is preceded by months of visits by prospective candidates and hordes of media, an economic and public relations bonanza for the small and largely rural state.

New Hampshire law mandates that its primary occur at least a week before any similar contests in other states, a position that Gardner guarded carefully through the 2008 and 2012 campaign cycles when the state’s primary was squeezed into early January.

Gardner told lawmakers he was grateful for their support.

“That’s why the country pays so much attention when we’re on the national stage,” he said. “The response from those who have actually done this over the years has been that New Hampshire has never let us down.”