The French parliament on Tuesday defied months of angry protests by approving a bill that is to make France the 14th country worldwide to legalise same-sex marriages.
But opponents to the law vowed to fight on, quickly filing a constitutional challenge and promising more demonstrations to pressure President Francois Hollande into backing down from signing the bill.
In its second and final reading, the lower house of parliament, the National Assembly, voted 331 to 225 to adopt the bill allowing homosexual marriages and adoptions by gay couples.
Justice Minister Christiane Taubira hailed the adoption of the bill as a "historic" moment.
"It grants new rights, stands firmly against discrimination (and) testifies to our country's respect for the institution of marriage," she said in a statement shortly after the vote.
"This is a victory for equality, for democracy and for coexistence," said Nicolas Gougain, a spokesman for Inter-LGBT, France's leading gay rights group.
"This law takes no rights away from anyone, it only grants rights to others. This is liberation after years of fighting for equality."
Shortly after the vote, lawmakers from right-wing parties said they had already filed a legal challenge with the constitutional council.
Senators from the main opposition UMP and other right-wing parties said "the definition of marriage, a fundamental principle... cannot be modified by a simple law."
They also said provisions allowing adoption by gay couples violate "fundamental principles" of France, including "the principle of human dignity and equality".
UMP lawmakers in the National Assembly also filed a challenge.
The council will have a month to make a ruling and opponents are hoping that in the meantime they can build up enough pressure to force Hollande, who has been steadfast in supporting the bill, to step back from signing it.
Former president Jacques Chirac shelved an unpopular employment law that had been passed by parliament in 2006, but Hollande is seen as unlikely to follow that precedent.
The government also is confident that the constitutional challenge will be dismissed.
"We have ensured that there is no legal weakness," Family Minister Dominique Bertinotti said. "The constitutional council is sovereign but the government is serene. We're confident."
Hundreds of thousands have taken to the streets in a series of protests against the bill, surprising many in a country that is predominantly Catholic but known for its secular traditions.
The opposition turned increasingly nasty as the final vote approached.
Some politicians received threats, a handful of demonstrations ended in violence and there was even a scuffle in parliament as the debate concluded in the small hours of Friday.
The tensions have also been linked to a spike in hate crimes against the gay community that have included attacks on bars and two serious assaults in Paris.
Hollande could scarcely have anticipated the scale of the opposition he would face over a reform that initially seemed to enjoy solid majority backing among French voters.
But recent polls have suggested a campaign in which the Roman Catholic Church initially played the leading role has shifted opinion to the extent that the electorate is now fairly evenly split on both gay marriage and adoption.
Hollande's girlfriend, Valerie Trierweiler, has revealed that the president will be attending the marriages of gay friends once the legislation is on the statute books.
In a Tweet after the vote, Trierweiler hailed Tuesday as a "historic day", using the hashtag "#equalityforall".
France's INSEE statistics agency says about 200,000 people declared themselves as living in same-sex couples in a 2011 study.
If Hollande signs the law, France will join eight other European countries -- the Netherlands, Belgium, Spain, Norway, Sweden, Portugal, Iceland and Denmark -- in legalising same-sex marriages.
New Zealand on April 17 became the first Asia-Pacific country to legalise same-sex marriages after a parliamentary vote overwhelmingly backed the move.