Media playback is unsupported on your device Media caption Supporters of the legalisation of gay marriage celebrate in the streets in Argentina

Argentina has become the first country in Latin America to legalise gay marriage after the Senate voted in favour.

The country's Chamber of Deputies had already approved the legislation.

The vote in the Senate, which backed the bill by just six votes, came after 14 hours of at times heated debate.

The law, which also allows same-sex couples to adopt, had met with fierce opposition from the Catholic Church and other religious groups.

The legislation, backed by President Cristina Fernandez's centre-left government, passed by 33 votes to 27 with three abstentions.

Image caption There were demonstrations for and against the bill outside Congress as senators debated

Outside Congress, as the debate continued into the early hours of Thursday, supporters and opponents of the bill held rival demonstrations.

"Nearly every political and social figure has spoken out in favour of marriage equality," said Maria Rachid, president of the Argentine Federation of Lesbians, Gays, Bisexuals and Transsexuals.

"And we hope that the Senate reflects this and that Argentina, from today forward, is a more just country for all families," she told the Associated Press.

All that my boyfriend and I want is to adopt a child and be accepted by society Lionel, Cordoba, Argentina Your commentsQ&A: Argentina gay marriage law

Ines Frank, from a group called Argentine Families Argentina, said opposition was not discrimination "because the essence of a family is between two people of opposite sexes".

There have been several gay marriages recently in Argentina, some of which were annulled by the Supreme Court, creating a legal controversy.

Civil unions between people of the same sex are legal in Buenos Aires and in some other provinces but there was no law to regulate it on a country-wide level.

Argentina's capital is widely considered to be among the most gay-friendly cities in Latin America. It was the first Latin American city to legalise same-sex unions.

Same-sex civil unions are also legal in Uruguay and some states in Brazil and Mexico, while gay marriage is legal in Mexico City.

To send your views, please join in our debate