The Supreme Court of Mexico ruled on Friday that the definition of marriage as the union of a man and a woman is discriminatory and unconstitutional.

According to the Catholic Herald, in its decision, the court stated that “procreation” was not a purpose for marriage, and, therefore, the restriction of marriage to heterosexual couples discriminated against same-sex couples:

Since the purpose of marriage is not procreation, there is not a justified reason that the matrimonial union be heterosexual, nor that it is stated as “between a man and a woman.” Such a statement proves discriminatory, based on the sexual orientation of the person.

The exclusion of couples of the same sex from the institution of marriage perpetuates the notion that couples of the same sex are less deserving of recognition than heterosexual (couples), offending with it their dignity as persons and integrity.

The court’s decision legalizes same-sex marriage in all of the 31 states of Mexico – which is over 80 percent Catholic – adding the country to the growing list of Latin American nations that permit it. Since current civil codes will remain temporarily, same-sex couples wishing to marry can obtain injunctions against laws holding up traditional marriage.

The Mexican Catholic bishops’ conference has disagreed with the court’s decision, stating that the family is founded on the marriage between a man and a woman who can procreate and, therefore, guarantee “the survival of society.”

In 2009, Mexico City legalized same-sex marriage at around the same time it decriminalized abortion and euthanasia, despite significant objection from the archdiocese of Mexico City, which also opposed the adoption of children by same-sex couples.

According to The New York Times, Msgr. Eugenio Lira Rugarcía, secretary general of the Mexican bishops’ conference, issued a statement responding that those in the church “reiterate our conviction, based on scientific, anthropological, philosophical, social and religious reasons, that the family, cell of society, is founded on the marriage of a man and a woman.”

He added that the Church’s view is “stated in the millennia of Western legal tradition, collected and deepened throughout our history by legislators and judges from very different schools of thought and ideologies.”

The Herald reports that, since 2010, attorneys for same-sex couples have worked seeking individual injunctions against laws defining marriage as between a man and a woman, and have won most of these cases.

Similarly, the Times indicates, “The shift in Mexico, the second-largest country in Latin America after Brazil, is the product of a legal strategy that advocates used to bypass state legislatures, which have shown little inclination, and often hostility, to legalizing gay marriage.”