The Swiss parliament has voted in favour of allowing gay couples to register their partnerships.
The Senate followed the House of Representatives by agreeing in principle to grant gays and lesbians similar entitlements to married couples.
The proposed new law, which now has to go back to the House of Representatives to iron out minor differences, recognises the right of both partners to be next of kin.
In the case of the death of one partner it would also allow the other to inherit shared property without having to pay a huge tax bill.
But no automatic rights would be granted to adopt children or have access to fertility treatment and no legal provision is planned which would allow gay couples to adopt a common surname.
A small religious conservative party in parliament has already made it clear that it will challenge parliament’s decision.
The gay rights group, Pink Cross, has welcomed the law as an important step towards ending discrimination against gays and lesbians in the areas of health insurance, pensions and taxes.
The group called on parliament to wrap up debate on the new legislation before the summer break.
Claude Janiak, a member of parliament for the centre-left Social Democrats, welcomed the outcome of the debate.
“Parliament has voted for a pragmatic solution which goes beyond that of Germany and other neighbouring countries,” Janiak told swissinfo.
But he added that Switzerland still lags behind Nordic countries when it comes to gay rights.
“It is true that it will have taken longer to find a realistic solution, but the law was accepted by parliament without much opposition.”
The move by parliament to offer gays and lesbians similar rights to heterosexual couples comes three years after the city of Geneva introduced its own legislation governing same-sex partnerships.
Last year Zurich became the second Swiss city to grant official recognition to gay couples.
The conservative religious party, the Federal Democratic Union, has come out against the new federal law.
The party argues that there is no need for new nationwide legislation, because equal rights are already guaranteed under civil law.
“We will feel compelled to mount a challenge if the law passes its final reading in parliament,” Christian Waber of the Federal Democratic Union told swissinfo.
The party says parliament’s role is to protect the family and it should not be encouraging alternative lifestyles.
Waber added that he had received pledges of support from numerous individuals and groups.
“I’m confident that we will be able to collect enough signatures to force a nationwide vote,” Waber said.
But Janiak appears unconcerned by the threat of a referendum.
“I’m waiting to see whether opponents will be able to challenge the law,” he said, “and I’m not worried about a possible nationwide vote.”
Gay marriages are legal in the Netherlands and Belgium as well as in some provinces of Canada and the US state of Massachusetts, according to a survey by the Associated Press news agency.
Over the past 15 years a number of European countries have introduced similar rights for gay couples.
Gay and lesbian couples are granted special legal status under French law, while Germany, Hungary and Croatia all recognise same-sex partnerships.
Portugal and several regional authorities in Spain give gay couples the same rights as their non-married heterosexual counterparts.
In South America, legislation is in place on a regional level in parts of Brazil and Argentina.
swissinfo, Urs Geiser
Under the law gay couples in Switzerland would be able to register their partnerships.
It would give gays and lesbians the same rights as heterosexual couples in pension, insurance and tax matters.
However, they would not have an automatic right to adopt children or have access to fertility treatment.
Parliament has approved in principle a proposal to grant gay and lesbian couples similar entitlements to married couples.
But a conservative religious party, the Federal Democratic Union, says it will challenge the decision by forcing a nationwide vote.
Gays and lesbians can already register their partnerships in the cities of Zurich and Geneva.