BERLIN — The German Parliament approved a proposal on Friday allowing same-sex marriage, after a short, suddenly scheduled debate.

The country’s normally staid politics were jolted in the direction of approving gay marriage last weekend when two major political parties said they would make the legislation a condition of any future coalition agreement with the Christian Democrats, led by Chancellor Angela Merkel, who is seeking a fourth term in the general election in September.

Ms Merkel reacted swiftly by easing her party’s stance against same-sex marriage and freeing individual lawmakers to vote on the issue as they saw fit.

Same-sex couples in Germany have been able to live together in civil unions since 2001, and opinion polls have shown for years that most Germans favour legalising same-sex marriage. But conservatives have consistently blocked the issue from coming to a vote in Parliament.

“I would like to lead the discussion more into a situation where it is a question of conscience, rather than something I push through with a majority vote,” Ms Merkel said on Monday. That prompted opposition parties to try to schedule a vote on the measure this week, before the Parliament’s summer recess.

For gay rights activists, the debate and vote on the measure are a turning point. “If the Constitution guarantees one thing, it is that anyone in this country can live as they wish,” said Thomas Oppermann, the parliamentary leader of the opposition Social Democrats, while debating the law. “If gay marriage is decided, then many will receive something, but nobody will have something taken away.”

Arnd Bächler, a counsellor and addiction therapist at a gay counselling centre in Berlin, praised the legislation.

“It’s very positive for the self-esteem of gays and lesbians; it’s very important for people coming out, knowing that they have this equality; and it sends a clear message to any homophobic refugees coming to Germany: We have equality here,” he said, anticipating that the legislation would pass.

Approval of same-sex marriage in Germany could build momentum for similar legislation in other German-speaking countries, like Austria and Switzerland, said Katrin Hugendubel, advocacy director of ILGA-Europe, a gay and transgender rights group. She said the developments in Germany illustrated the difference that opposition parties could make.

“For us, the most important lesson is for the opposition to be very outspoken in supporting L.G.B.T.I. rights,” Ms Hugendubel said. “The Social Democrats’ and the Greens’ making it a coalition condition raised the pressure on the conservatives, so it’s very important that those in favour across Europe make it a condition, and be very strong in their support.”

Some of the more conservative members of Ms. Merkel’s wing expressed dismay with these fast-moving developments.

“To me, it remains clear that same-sex partnership is not the same thing as a marriage. In our cultural circles, marriage has for centuries been a union between man and woman,” said Volker Kauder, the parliamentary leader of the conservative bloc of the Christian Democratic Union and Christian Social Union.

More than a dozen European countries have legalised same-sex marriage, including Ireland, France and Spain.

Christine Lüders, the director of the German government’s anti-discrimination agency, said that the legislation was “not about special rights for anyone, but about equal rights.”

Ms. Lüders said adopting the law would play a significant role in combating discrimination, by helping make same-sex relationships a social norm in Germany, as they have become in many countries across Europe.

“I am certain that just a few years from now, as a society, we will look back on this decision on marriage equality and ask ourselves, ‘Why on earth did it take us so long?’” Ms Lüders said.