A legal agreement made between two gay men is still valid, despite the fact that that their wedding is not legal, a New York court has ruled.

Steven Green, 41, and David Gonzalez, 29, travelled to Massachusetts on Valentines Day 2005 to get married.

Seven months later, when the relationship broke down, lawyers for Mr Green drew up a separation agreement, which both parties signed.

Green got back the ski lodge he had given as a gift to his younger lover, and in return he paid Gonzalez $780,000. (£402,373)

In January 2006, however, Gonzalez chose to sue for divorce, which led Green to countersue, demanding his money back.

New York law does not recognise same-sex marriages, and therefore Judge Phyllis Gangel-Jacob threw out Gonzalez’s divorce petition.

The seperation agreement, on the other hand, was perfectly legal, she ruled.

A ruling from the New York Court of Appeals in July 2006 had ruled that gay and lesbian couples have no right to marry under state laws.

“While cohabitation without marriage does not give rise to the property and financial rights which normally attend the marital relation,” Justice Gangel-Jacob wrote, according to The New York Times.

“Neither does cohabitation disable the parties from making an agreement within the normal rules of contract law.”

The judge also commented that contracts drawn up between people who are co-habiting are just as legal as all other contracts.

Mr. Wrubel, the lawyer representing Mr Gonzalez, told the Times, “For homosexual couples, in order to protect themselves and have orderly protection of their assets, they can now rely on agreements.”