PARIS — On Tuesday afternoon, France is expected to become the 14th country to legalize marriage for all couples, regardless of gender or sexual orientation.

The final vote in the legislature is expected to be quick, since the Socialist government of President François Hollande has a safe voting majority. But there has been an intensification of opposition to the bill in the past few weeks, as Mr. Hollande’s critics have used demonstrations against it as a way of attacking the president himself.

Though hesitant at first, since polls show a majority of the French favor equal rights for same-sex couples, the center-right Union for a Popular Movement has embraced the demonstrations opposing the bill. The unity around the issue has helped paper over the sharp divisions and rivalries in the party, which is largely rudderless as its leader, former President Nicolas Sarkozy, weighs returning to active politics.

At the margins, the demonstrations have also become more violent and homophobic, with a series of nightly demonstrations last week around Parliament that resulted in clashes with riot police officers and a number of arrests. Even opposition leaders have bemoaned the way harder-right groups have infiltrated the demonstrations, and there has been a small surge in violence against gay men and lesbians, with some beatings and angry, offensive words on social media.