A previous court had ruled in favor of activist Oscar Ugarteche, who married his partner in Mexico and sued for it to be considered valid in his native Peru.
A Lima's court annulled Wednesday a previous sentence that ordered the government to recognize and register same-sex marriages in the country.
The ruling comes more than one year after a court ordered on December 2016 that Peruvian authorities register the marriage of Peruvian citizen Oscar Ugarteche and Mexican Fidel Aroche —who got legally married in Mexico in October 2010, after a long judicial battle.
Ugarteche asked Peru's authorities to register the marriage in January 2012, but they declined the request three months later considering that same-sex marriage was not legal in the country.
The couple later won the appeal, until the Superior Court of Lima took sides with the National Record of Civilian Status, arguing that the couple failed to respect the delays imposed by the law for the appeal, and cancelling the entire judicial procedure.
Earlier in January this year, the Inter-American Court of Human Rights ruled that countries in the region should legalize same-sex unions, endorsing a growing push for marriage equality despite opposition from the Roman Catholic Church.
A number of Latin American countries, including Costa Rica, do not allow same-sex marriage. However, that trend is changing and in recent years same-sex couples have been allowed to marry in Argentina, Brazil, Colombia, Uruguay and some parts of Mexico, despite church opposition.