Ljubljana (AFP) - Slovenia's parliament voted Tuesday to legalise same-sex marriages and grant such unions equal rights to those of heterosexual couples.

The bill was approved by a vote of 51 to 28 in the 90-seat parliament. Five of the 84 lawmakers present at the session abstained.

The bill, proposed by the opposition United Left (ZL), was supported by the ruling coalition's senior Miro Cerar Party as well as other centre-left parties.

"This amendment defines marriage as a life-long community of two persons, regardless of their sex, eliminating the discriminative situation in force up to now," Matej T. Vatovec, a ZL legislator, told lawmakers when introducing the bill.

Centre-right opposition parties were opposed to the text, saying it would enable same-sex couples to adopt children and undermine traditional family values.

During the session, some 2,000 people gathered in front of parliament to protest against the bill and announce they will launch a petition for a referendum to prevent it from entering into force.

According to Slovenia's legislation, a referendum on the implementation of a bill can be called if 40,000 citizens with their signatures back such a vote.