A gay man has won a landmark legal battle at the UK's highest court to secure his husband the same pension rights a wife would enjoy.
Two years ago, ex-cavalry officer John Walker, 66, was told by judges that his claim failed because it applied to a period before gay civil partnerships were recognised by the law.
But on Wednesday five Supreme Court justices ruled that Mr Walker's husband is entitled on his death to a spouse's pension, provided they stay married.
Mr Walker launched legal action because he wanted to ensure that, should he die first, his husband, who is in his fifties, will be adequately provided for.
He and his husband, a former computer executive who prefers not to be named, have been together since 1993.
The Civil Partnership Act 2004 came into force on 5 December 2005.
Mr Walker and his partner entered into a civil partnership in January 2006, which was later converted into a marriage.
- 'A victory for basic fairness and decency'
Mr Walker said: "I am absolutely thrilled at today's ruling, which is a victory for basic fairness and decency.
"Finally this absurd injustice has been consigned to the history books - and my husband and I can now get on with enjoying the rest of our lives together.
"But it is to our Government's great shame that it has taken so many years, huge amounts of taxpayers' money and the UK's highest court to drag them into the 21st century.
"In the years since we started this legal challenge, how many people have spent their final days uncertain about whether their loved one would be looked after?
- What does the ruling mean for pensions?
In their ruling the panel of Supreme Court justices, headed by the court's deputy president Lady Hale, made a declaration that the exemption under the 2010 Equality Act was "incompatible with EU law and must be disapplied".
The decision means Mr Walker's husband will be entitled to a spouse's pension of around £45,000 a year, rather than about £1,000 which he would have received.
During the Supreme Court hearing in March, a QC for the Work and Pensions Secretary pointed out that the costs involved in "requiring all pension schemes to equalise entitlements retrospectively" would be £100 million for private sector schemes and a further £20 million for public sector schemes.
- Brexit 'risks losing LGBT rights'
Human rights organisation Liberty said the ruling could change the lives of thousands of couples.
It added that any company using the Equality Act to exclude same-sex partners from pension benefits in the same way would now be breaking the law.
But the organisation warned action would need to be taken if there is to be a lasting legacy of the case post Brexit.
Liberty lawyer Emma Norton said: "This ruling was made under EU law and is a direct consequence of the rights protection the EU gives us.
"We now risk losing that protection. The Government must promise that there will be no rollback on LGBT rights after Brexit - and commit to fully protecting them in UK law."
A Government spokesman said: "We are reviewing the implications of this judgement in detail and will respond in due course.
"The rights of same sex couples have been transformed for the better since 2010 including the introduction of same sex marriage and legislation to ensure that pensions are built up equally for all legal partnerships."