A recently repealed law that barred Canadians living abroad for more than five years from voting in federal elections was an unjustified violation of the Constitution, Canada's top court ruled on Friday.

In a long-awaited decision that solidifies voting rights, the Supreme Court of Canada rejected government arguments that the law, enacted in 1993, promoted electoral fairness.

Writing for the 5-2 majority, Chief Justice Richard Wagner called the right to vote a "core tenet" of Canadian democracy. Any limit, he said, would have to have "compelling" justification -- something the government had failed to offer.

"The vague and unsubstantiated electoral fairness objective that is purportedly served by denying voting rights to non-resident citizens simply because they have crossed an arbitrary five-year threshold does not withstand scrutiny," Wagner said. "There is little to justify the choice of five years as a threshold, or to show how it is tailored to respond to a specific problem."

The impugned provisions of the Canada Elections Act had been on the book for decades but it was only under the Conservatives of then-prime minister Stephen Harper that Elections Canada began active enforcement.

After being denied the right to vote in the 2011 election, two long-time expats living and working in the United States, Gill Frank and Jamie Duong, launched the charter challenge.

Essentially, Frank and Duong argued that nothing warranted the abridgment of their constitutionally-guaranteed right to vote. They insisted they maintain deep ties to Canada, and taxes and other laws passed by Parliament still affect them.

For its part, the federal government conceded the five-year limit violated the Constitution. However, it argued the measure was democratically justified on fairness grounds because resident Canadians are directly affected by Parliamentary decisions, unlike those abroad.

The Supreme Court disagreed, saying the harms caused by the law outweighed any "speculative" benefits it might have.

"The measure improperly applies to many individuals with deep and abiding connections to Canada and to Canadian laws (and) does so in a manner that is far broader than necessary to achieve the electoral fairness objective," Wagner wrote. "The disenfranchisement of these citizens not only denies them a fundamental democratic right, but also comes at the expense of their sense of self-worth and their dignity."

The expat voting issue took on prominence in the 2015 election and the campaigning Liberals promised a review. After winning office, the government under Justin Trudeau, which faces an election in October, passed electoral-reform legislation last month that did away with the five-year provision.

In an interview from Richmond, Va., Frank expressed delight with a ruling he said had practical implications even though the offending law was recently repealed. He no longer has to worry, he said, that a future government might again strip him of his vote.

"This is now made permanent," said Frank, 40, who is with the University of Virginia. "I feel secure in my democratic rights, and that hundreds upon hundreds of thousands of other Canadians who have left Canada for various reasons will never again feel that their right to access their government will be compromised."

Duong, 35, of Ithaca, N.Y., echoed similar sentiments.

"We are thrilled that (the Liberals) changed the law but we've really been looking forward to this Supreme Court decision to make sure that those rights are protected going forward," said Duong, who works in IT at Cornell University.

Toronto-based lawyer Andrew Bernstein, who was not involved in the case, said the Supreme Court has historically been deferential to Parliament when it comes to election laws. This decision, he said, signals a shift.

"In deciding who gets to participate in elections, the court came out strongly in favour of voting rights and set a pretty high bar for depriving any citizen of the right to vote," Bernstein said.

The case, which garnered attention from civil liberties groups, initially went in favour of Duong and Frank when an Ontario Superior Court justice sided with them in 2014. However, the federal government appealed and, in a split decision in 2015, the Ontario Court of Appeal overturned the earlier ruling.

While the Appeal Court agreed the law infringed on the rights of citizens, the majority found the infringement justified in a democracy because the rules preserved the "social contract" between voters and lawmakers.

The Supreme Court flatly set aside that notion, saying the government had failed to offer evidence in support of its social contract theory.

"The world has changed," Wagner wrote. "Canadians are both able and encouraged to live abroad but they maintain close connections with Canada in doing so. Citizenship, not residence, defines our political community and underpins the right to vote."

In a dissenting minority opinion, justices Suzanne Cote and Russell Brown called the five-year restriction reasonable. They note not all Canadians -- such as those who have never lived in Canada -- are allowed to vote. This decision will change that, they said.

"We see this development as regressive, undermining the long-standing and entirely salutary practice in Westminster parliamentary democracies of privileging local connections in deciding who may elect local representatives," Cote and Brown said.