The Supreme Court has ordered a total recount of votes cast in the 2014 local elections for the Listowel electoral area in north Kerry.
The judgment has implications for future elections.
In a unanimous decision, the court upheld a claim by former Senator Dan Kiely that there was a mistake in the conduct of the local elections, rendering it unlawful.
Four of the five judges ruled there should be a recount.
The central issue in the case was whether a ballot paper which had a sequence of preferences, not starting with 1 could be deemed a valid vote in an election.
The court ruled that votes containing a sequence of numbers not beginning with '1' had to be excluded from the recount.
The court had heard that election observers had noticed that on days where there is more than one election, many people cast their 1st and 2nd preference on one ballot paper and put 3rd, 4th and 5th preferences on the other ballot paper.
In Mr Kiely's case, the local elections took place on the same day as European elections. The returning officer for Listowel allowed ballot papers with preferences not starting with 1 to be included in the count.
Mr Kiely had argued that because there was no mark on the disputed ballot papers indicating a voter's first preference, they should be excluded.
Kerry County Council had claimed ballot papers where the first number written against a candidate was 3 could be interpreted as giving first preference to that candidate. But the Supreme Court found in favour of Mr Kiely.
Mr Kiely narrowly lost out in a battle for the last seat in the electoral area.