Days after killing himself, a vocal campaigner for gun rights and Republican presidential candidate Donald Trump has won a New York primary election.

Assemblyman Bill Nojay was facing a fraud trial in Cambodia and was reportedly under FBI scrutiny when he went to his family's cemetery plot in Rochester and shot himself in front of a police officer on Friday.

Now the defeat on Tuesday of challenger Richard Milne coupled with a quirk in state election law means that local Republican leaders, who encouraged voters to choose Mr Nojay despite his death, get to pick someone to take on Democrat Barbara Baer in November.

Mr Nojay's Republican-leaning district in the Legislature's lower chamber covers parts of suburban Rochester and the Finger Lakes region.

"I really don't know what to say. It's such an unusual situation," Mr Milne told The Associated Press as unofficial results showed him trailing by nearly 1,000 of the 4,500 votes cast.

Though he hopes the three county leaders put him on the ballot, Mr Milne was critical of "robocalls" and other efforts by the "powers that be" to boost Mr Nojay after his death.

"They really did some things in the past few days that were in poor taste in my opinion to sway the vote," he said.

While rare, posthumous elections do happen, notably when Missouri Democratic Governor Mel Carnahan died in a plane crash but defeated the Republican incumbent and future US Attorney General John Ashcroft in a 2000 Senate race.

That victory led to the appointment of Mr Carnahan's widow, Jean Carnahan, to the Senate. Since 1962, four people who died close to Election Day have been elected to the House of Representatives.

Mr Nojay, a 59-year-old Rochester native and father of three, was elected to the Assembly in 2012.

He quickly emerged as a leading critic of stricter gun control laws that Democratic Governor Andrew Cuomo pushed through the Legislature after the Sandy Hook Elementary School massacre.

He had graduate degrees in law and business from Columbia University and was a research fellow at Tribhuvan University in Kathmandu, Nepal, according to his official biography.

In addition to his work as a lawyer and politician, Mr Nojay hosted a regional conservative talk radio show and encouraged Mr Trump when he previously flirted with running for governor of New York.

The authorities have not said what might have been behind Mr Nojay's suicide, but multiple Rochester media outlets have reported he was due to surrender to the FBI to face fraud charges on the afternoon he killed himself near his brother's grave. Prosecutors have declined to comment on that case.

Mr Nojay and two other men were also facing trial in Cambodia on fraud charges, accused of cheating an investor of £758,000 in a proposed rice exporting business. Mr Nojay denied fraud was committed.

"All the people I've worked with have been honourable people, but again, some of them have done well, and some of them have stumbled. That's just the nature of small business work," Mr Nojay told Rochester's WHAM radio the day before he died.

Mr Milne, who is mayor of Honeoye Falls, said he ran a "clean and solid race" and was disappointed.

"I really believe we would have fared better with Mr Nojay still alive," he said.

AP