In what is being described as the country's first gay marriage, a Brazilian state judge on Monday allowed a gay couple to convert their civil union (known as a stable relationship) into a marriage.

Sao Paulo state Judge Fernando Henrique Pinto okayed a request by Sergio Kauffman Sousa and Luiz Andre Moresi to convert their civil union into a full marriage.

Last month, Brazil's top court ruled gay and lesbian couples could not be denied a civil union, but stopped short of legalizing gay marriage. (Previously, civil unions for gay couples had been available in several regions.) Pinto said in a statement that he based his ruling on the Supreme Court's ruling and on Brazil's constitution, which allows a couple to convert a civil union into a legal marriage.

The gay rights group Associacao Brasileira de Gays, Lesbicas e Transgeneros (ABGLT) hailed the ruling, calling it the country's first gay marriage.

β€œIt's a great joy,” Sousa told Globo's television network G1. β€œI'm still trying to understand this historical moment.”

The men, who have been together 8 years, said they would apply for a marriage certificate on Tuesday.

Argentina last year became the first Latin American country to legalize gay marriage. It's also legal for gay couples to marry in the city-state of Mexico City. Mexico's Supreme Court has ruled that states must recognize the legal marriages of gay couples.