Assemb. Todd Kaminsky appeared in Elmont earlier this month with ex-President Bill Clinton, who lauded and endorsed the Long Beach Democrat’s State Senate bid.

But Kaminsky, a Democratic state assemblyman from Long Beach who declared victory in the Senate race on Tuesday, may wish to send a thank-you note to Bernie Sanders.

See alsoSee latest 9th Senate District resultsStory780 votes separate Dems, GOP in race for Skelos seat

After all, it was the Vermont senator who made the primary competitive enough in Hillary Clinton’s home state to boost Democratic turnout for his special Senate contest.

Kaminsky currently leads Republican newcomer Christopher McGrath by 780 votes in unofficial returns, pending a certification process. McGrath, an attorney from Hewlett, has not conceded.

Nassau County GOP chairman Joseph Mondello told Newsday’s Joye Brown in the aftermath: “Hillary brought out a lot of votes.” Democratic turnout in Elmont and North Spring Valley “was very heavy, and it made a difference,” Mondello said.

advertisement | advertise on newsday

“There’s no question,” replied Nassau Democratic chairman Jay Jacobs, “that had the Republican primary been competitive the way it was and had the Democratic primary already been decided, the outcome would likely have been different because of turnout.”

“That was the concern from day one,” Jacobs said. “That said, it is important to note that given that the turnout percentage [among Democrats and Republicans] was virtually identical, the outcome was determined by the campaign, the candidates, and the issues.”

Some Sanders voters in the 9th Senate District might have filled in the special-election ballot for Laurence Hirsh, the Green Party candidate whose tally so far is 772 votes.

But the all-Nassau 4th Congressional District, which includes the 9th Senate District, showed a heftier Democratic turnout than districts to its east.

The same was true for Republicans in the congressional district, two-thirds of whom voted for Donald Trump.

The McGrath-Kaminsky race also may have helped spur voting in the presidential primary.

Either way, those who worked in the Kaminsky effort underscored the separate, specific circumstances of the Senate race: the conviction of former Majority Leader Dean Skelos, which created the vacancy; the intensive door-knocking, phone calls and canvassing and mobilization of party resources for a seat that stood to possibly change the Senate majority.

Campaign operatives also noted that 9th District voters on Tuesday weren’t simply filling out ballots by party; they had to stand on two lines to vote in primary and the general, further distinguishing the results.

advertisement | advertise on newsday

As much as presidential politics apparently shaped turnout in this special election, it is expected to do so all over the state in November, when both national nominees top the major-party tickets and all 213 state legislative seats are on the ballot.