The new ruling is the second court ruling on the matter.

Back in January, the Inter-American Court of Human Rights ruled that all countries under its jurisdiction needed to legalise same-sex marriage. Costa Rica said it would comply, but the day before the first same-sex wedding was due to take place it was cancelled.

The country was then thrown into a General Election, where the legalisation of same-sex marriages became one of the key campaigning points, because of the homophobic pastor, Fabricio Alvarado Muñoz. Thankfully, when the results came in, he was beaten by a comfortable margin.

And now, the Supreme Court in Costa Rica has ruled that the ban on same-sex marriages is unconstitutional and that the country needs to legalise same-sex marriage within 18 months, this makes February 2020 the latest that they can remain banned.

If legislative procedures are not in place by then, then same-sex marriages will automatically become legal.

Related: Costa Rica’s former vice-president says that the gay marriage debate was “hell” for LGBTQ people

Thankfully, the country’s president, Carlos Alvarado Quesada has vowed to pass a law to comply with the ruling. In a statement, he said that he and the executive “respect” the decision that the court made.

He added: “We trust that respect for human rights and the rule of law will prevail, whether the Legislative Assembly recognises equal marriage in the next 18 months, or failing that, once the time limit expires and the current law is made invalid.

“On our part, we will continue to promote actions that guarantee the non-discrimination of any person due to their sexual orientation or gender identity, and extend the protection of the State to all families equally.”

This follows up on comments that Quesada made after winning the election, where he said said: “My commitment is to a government for everybody, in equality and liberty for a more prosperous future.

“There is much more that unites us than divides us.”

Costa Rica isn’t the only country where the legalisation of same-sex marriages could soon become a reality. Cuba’s new constitution has defined marriage as a “voluntary and consensual union between two people without distinction of sex.” Although this hasn’t legalised same-sex marriages, it has made it eaiser for future legislative or legal processes.

Related: Czech Republic government back a draft bill which would see same-sex marriage legalised