Two Irish men have married in Dublin to avoid paying €50,000 in inheritance tax on a house.

Best friends Matt Murphy and Michael O’Sullivan are both heterosexual, but decided to get married when they discovered how much tax would have to be paid on the house Murphy, 83, intended to leave in his will to O’Sullivan, 58, who is his carer.

Same-sex marriage was legalised in Ireland following a referendum in May 2015.

Best friends Michael O'Sullivan and Matt Murphy ahead of civil marriage in order to avoid inheritance tax. More @IrishMirror pic.twitter.com/skGJLeqoxN — Emma McMenamy (@emmamcm) December 22, 2017

“I’ve known Matty for 30 years. We became very friendly after my second relationship broke up,” O’Sullivan, a father of three, told the Irish Mirror.

“I have been bringing Matt out in my car to various parties and all that kind of thing. He became friends with all my friends, they all loved him.”

Each man went through some tough times, with O’Sullivan becoming homeless and Murphy suffering from giant cell arteritis, which affects the optic nerve.

“I stayed over with him for a while and eventually Matt said ‘Why don’t you come and stay here?’ I would go over and stay with him the odd time but never full time.”

Murphy could not afford to pay O’Sullivan as a carer. “Eventually Matt said the only way he could pay me was to leave me the house. He said he would give me the house so I have somewhere to live when he goes.”

However, O’Sullivan knew that would mean a huge tax bill and the house would have to be sold to pay it. He said Murphy “was chatting a friend down the country in Cashel, Co Tipperary, and she jokingly said we should get married.

“Then one night he turned around and said it to me and I said I would marry him.”

O’Sullivan paid tribute to Ireland’s LGBT community. “The equality gay and lesbian people did for this country, that they fought hard for, they were discriminated against for most of their lives, they got equality for themselves but also for everybody else.”

The couple got married in a former hospital on Dublin’s Grand Canal Street, followed by a meal for five at the nearby Gasworks bar.

O’Sullivan was previously married to a woman. It is Murphy’s first marriage.

During the wedding ceremony O’Sullivan spoke of his husband’s great kindness, the Irish Times reported, while Murphy sang Willie Nelson’s Let the Rest of the World Go By: “With someone like you, a pal good and true / I’d like to leave it all behind and go and find / A place that’s known to God alone.”

O’Sullivan said after the ceremony: “I love Matt and he loves me, as friends.”

• This article was amended on 28 December 2017 to correct the title of the song “Let the Rest of the World Go By”.

