(Getty)

A landmark court ruling has ordered 16 new countries to make same-sex marriage legal.

The Inter-American Court of Human Rights reached a decision today on a marriage equality petition submitted two years ago by Costa Rica President Luis Guillermo Solis.

20 countries agreed to follow the court’s rulings when they signed the American Convention on Human Rights, including 16 which have not yet legalised same-sex marriage.

These countries are Barbados, Bolivia, Chile, Costa Rica, the Dominican Republic, Ecuador, El Salvador, Guatemala, Haiti, Honduras, Mexico, Nicaragua, Panama, Paraguay, Peru and Suriname.

Argentina, Brazil, Colombia and Uruguay, who also follow the court’s decisions, have already legalised same-sex marriage.

More than 280 million people live in the other 16 countries, which the court has told to treat its same-sex partners the same as straight couples.

The governments were ordered to “guarantee access to all existing forms of domestic legal systems, including the right to marriage, in order to ensure the protection of all the rights of families formed by same-sex couples without discrimination”.

And the court has recommended that these rights be locked in with temporary decrees while the countries’ governments go through the process of passing permanent laws.

The ruling also informed countries that they should allow transgender people to change their name on identity documents.

Costa Rica has already publicly agreed to follow the court’s ruling, with the government sending showing its support.

And its people have been celebrating.

Que sí… Que sí… La corte dijo sí pic.twitter.com/g6ejwCKphM — David Zuiga (@daviiidez) January 10, 2018

In a statement, the government wrote: “Love is a human condition that should be respected, without discrimination of any kind.

“The State confirms its commitment to comply”.

Costa Rican Vice President Ana Helena Chacón said: “Today is an historic day, a day of light.

“The Inter-American Court vindicates the rights of LGBTI persons under the American Convention, and reminds all the states of their responsibility and historical moral obligation to this population.”

Writing on Twitter, she added that “even in the darkest corners of our continent, the future generations of LGBTI people will have equality, equal opportunities to develop their own projects of life, and happiness to grow without fear.”

The move follows other steps towards LGBT equality made over the past year in South America, including Uruguay appointing its first trans senator.

Michelle Suarez took her seat in October, while pledging to push for a law which would make it compulsory for one percent of government jobs to be reserved for trans people.

And the ruling also follows Australia’s decision to legalise same-sex marriage, which came into effect earlier this week.