Portugal's parliament passed a bill Friday that would make the predominantly Catholic nation the sixth in Europe to permit gay marriage.
Conservative President Anibal Cavaco Silva is thought unlikely to veto the Socialist government's bill, which won the support of all left-of-center parties. His ratification would allow the first gay marriage ceremonies to take place in April - a month before Pope Benedict XVI is due on an official visit to Portugal.
Right-of-center parties opposed the change and sought a national referendum on the issue, but their proposal was rejected, and the government's bill was passed by 125 votes to 99.
Gay rights campaigners applauded from the galleries, hugged and kissed outside the building, and ate wedding cake.
"This law rights a wrong," Prime Minister Jose Socrates said in a speech to lawmakers, adding that it "simply ends pointless suffering."
Socrates said the measure is part of his effort to modernize Portugal where homosexuality was a crime until 1982. Two years ago his government lifted Portugal's ban on abortion, despite church opposition.
Gay marriage is currently permitted in Belgium, the Netherlands, Spain, Sweden and Norway. Canada, South Africa and six U.S. states also permit it.
The bill removes a reference in the current law to marriage being between two people of different sexes.
"It's a slight change to the law, it's true," Socrates, the prime minister, said. "But it is a very important and symbolic step towards fully ensuring respect for values that are essential in any democratic, open and tolerant society: the values of freedom, equality and non-discrimination."
Like neighboring Spain, which introduced same-sex marriages four years ago, Portugal is an overwhelmingly Roman Catholic country and previous efforts to introduce gay marriage ran into strong resistance from religious groups and conservative lawmakers.
Paulo Corte-Real, head of a lobby group called Lesbian, Gay, Bisexual and Transsexual Intervention, said Portugal had become a pioneering country in gay rights.
"This is a historic moment. We just hope (the bill) gets ratified quickly," he said.
Socrates said a referendum was not necessary because the gay marriage proposal was included in the Socialist Party's manifesto in last September's general election, when it was returned to power.
In 2001, a law allowed "civil unions" between same-sex couples which granted them certain legal, tax and property rights. However, it did not allow couples to take their partner's name, inherit their possessions nor their state pension, which is permitted in marriages.
A proposal from the Left Bloc and Green Party allowing gay couples to adopt children was voted down Friday. Gay campaigners said they would continue to fight for gay couples' parental rights.
The main opposition Social Democratic Party proposed granting non-married cohabiting couples of the same sex more rights, as in France, but its bill also was rejected.
By Associated Press Writer Barry Hatton