A court has ruled Mexico’s bans on same-sex marriage are unconstitutional, effectively legalising it.

Some states had already begun to overturn bans, and marry same-sex couples, but a decision has now been made on a country-wide level.

The ruling states: “As the purpose of matrimony is not procreation, there is no justified reason that the matrimonial union be heterosexual, nor that it be stated as between only a man and only a woman.

“Such a statement turns out to be discriminatory in its mere expression.”

In April, a court ruled the bans unjustifiable, saying “For all of those relevant effects, homosexual couples can find themselves in an equivalent situation to heterosexual couples, in such a way that their exclusion from both institutions is totally unjustified.”

Mexico City law professor Estefanía Vela Barba told the New York Times: “Without a doubt, gay marriage is legal everywhere.

“If a same-sex couple comes along and the code says marriage is between a man and a woman and for the purposes of reproduction, the court says, ‘Ignore it, marriage is for two people.

However, same-sex marriage has not been specifically written into law, and same-sex couples may still require a judge’s approval before being wed.

The first gay couple married in Baja California earlier this year.