A legal challenge against Sinn Fein MP Michelle Gildernew's four-vote General Election victory in Fermanagh and South Tyrone has been rejected.
The case had been taken by defeated unionist unity candidate Rodney Connor, who lost out after three recounts.
Northern Ireland's Lord Chief Justice Sir Declan Morgan, who sat with Justice John Gillen, said while the NI Electoral Office had breached election rules in the May poll it did not affect the outcome.
The judges also said allegations that a Sinn Fein official had been seen handing out fake ballots at one polling station were "without foundation".
After the judgment at Belfast High Court, an overjoyed Mrs Gildernew expressed her relief. "I'm glad it's over, I have to say," she said. "It is high time that political unionism accepted the democratic will of the people.
But Mr Connor, who ran as an independent unionist with the backing of the Democratic Unionists and Ulster Unionists, said his decision to take the case had been vindicated despite its failure. "It (the judgment) identified clearly that we were right to take the action that we have taken," he said.
"I must say as well, for all the people who voted for me and supported me all through the election campaign, it's most unfortunate that they will still be unrepresented at a time like this at Westminster when we really need to be represented."
In a dramatic night of counting at Omagh Leisure centre, Mr Connor came out ahead by eight votes in the first count - 21,296 to 21,288. But three subsequent recounts, the last one conducted the morning after, all had Mrs Gildernew as the victor - by 10, two and then four votes. Despite Mr Connor's demand for a fourth recount, Chief Electoral Officer Douglas Bain declared a Sinn Fein win.
The legal bid to overturn the result was heard by the Lord Chief Justice and Justice Gillen at a special electoral court in Dungannon last month. Delivering their reserved judgment in Belfast High Court, Sir Declan said Parliamentary Election rules had been breached in regard to how votes had been accounted for.
Doubt centred on 36 disputed ballots, but during the case 33 of those were confirmed as valid. Conceding that three votes were still unaccounted for, Sir Declan pointed out those would not have influenced the outcome.