CAPE TOWN, South Africa (AP) -- The South African parliament passed legislation recognizing same-sex marriages Tuesday in an unprecedented move on a continent where homosexuality is taboo.

African National Congress veterans heralded the Civil Union bill for extending basic freedoms to everyone and equated it with liberation from the shackles of apartheid.

The bill's supporters had to overcome criticism from both traditionalists and gay activists and warnings that the legislation may be unconstitutional.

"When we attained our democracy, we sought to distinguish ourselves from an unjust painful past, by declaring that never again shall it be that any South African will be discriminated against on the basis of color, creed culture and sex," Home Affairs Minister Nosiviwe Mapisa-Nqakula told the National Assembly.

But a Christian lawmaker, Kenneth Meshoe, said it was the "saddest day in our 12 years of democracy" and warned that South Africa "was provoking God's anger."

One church leader in Nigeria denounced the move as "satanic," reflecting the views on a deeply conservative continent where some countries are debating constitutional amendments to ban same-sex marriages.

But gay rights groups in Europe hailed South Africa as a shining example of progressiveness.

The National Assembly passed the Civil Union Bill, worked out after months of heated public discussion, by a vote of 230 to 41 with three abstentions. The outcome was expected given the ANC's huge majority. It now has to be approved by the National Council of Provinces, which is expected to be a formality, before being signed into law by President Thabo Mbeki.

The bill provides for the "voluntary union of two persons, which is solemnized and registered by either a marriage or civil union." It does not specify whether they are heterosexual or homosexual partnerships.

But it also says marriage officers need not perform a ceremony between same-sex couples if doing so would conflict with his or her "conscience, religion and belief."

South Africa recognized the rights of gay people in the constitution adopted after apartheid ended in 1994 -- the first in the world to prohibit discrimination on the basis of sexual orientation.

The bill was drawn up in order to comply with a Constitutional Court ruling last December that said existing marriage legislation was unconstitutional, as it discriminated against same-sex couples.

The court gave the government a December 1 deadline to change the laws, saying that otherwise same-sex marriages would be legalized by default.

"In order to give effect to the Constitutional Court ruling, same-sex couples have to be allowed to marry so that they can enjoy the status, obligations and entitlements enjoyed at the moment by opposite sex couples," Mapisa-Nqakula said.

The Roman Catholic church and many traditional leaders objected to the use of "marriage" saying this denigrated the sanctity of traditional marriages.

In an effort to ease some of these concerns, the drafters of the bill allowed both religious and civil officers to refuse to marry same-sex couples.

Gay rights groups criticized this "opt-out" clause, saying they should be treated the same as heterosexual couples.

But in general, they hailed the new measure.

"It demonstrates powerfully the commitment of our lawmakers to ensuring that all human beings are treated with dignity," said Fikile Vilakazi of the Joint Working Group, a national network of 17 gay and lesbian organizations.

In Africa, homosexuality is still largely taboo. It is illegal in Zimbabwe, Kenya, Uganda, Nigeria, Tanzania, Ghana and most other sub-Saharan countries. Even in South Africa, gays and lesbians are often attacked because of their sexual orientation.

Denmark in 1989 became the first country to legislate for same-sex partnerships and several other European Union members have followed suit. In the United States, only the state of Massachusetts allows same-sex marriage, Vermont and Connecticut permit civil unions, and more than a dozen states grant lesser legal rights to gay couples.

Copyright 2006 The Associated Press. All rights reserved.This material may not be published, broadcast, rewritten, or redistributed.

The South African Parliament on Tuesday overwhelmingly voted to legalize same-sex marriages, making the nation the first in Africa and the fifth in the world to remove legal barriers to gay and lesbian unions, according to activists.

The legislature voted after the nation's highest court ruled that South Africa's marriage statutes violated the Constitution's guarantee of equal rights. The court gave the government a year to amend the legal definition of marriage. That deadline expires in two weeks.

Netherlands, Belgium, Spain and Canada allow same-sex marriages. In most African nations, homosexuality is still treated as a crime, said Melanie Judge, program manager for OUT, a gay rights advocacy group. Some penalties are harsher than those for rape or murder.

She credited South Africa's liberal constitution with forcing change.

"This has been a litmus test of our constitutional values," she said in a telephone interview. "What does equality really mean? What does it look like? Equality does not exist on a sliding scale."

Religious groups and traditional leaders strenuously opposed the measure, arguing that if necessary the Constitution should be amended to outlaw same- sex unions. But the governing African National Congress virtually demanded that lawmakers support the bill.

Despite deep divisions within the party, the measure passed 230 votes to 41. It must now be approved by the Council of Provinces, a quasi-federal chamber, and be signed the president to become law.

Vytjie Mentor, the party's caucus chairman, told The Sunday Independent newspaper earlier this month that he expected ANC legislators to vote for the measure, regardless of their personal views.

There is "no such thing as a free vote or a vote of conscience," he said. "How do you give someone permission to discriminate in the name of the ANC? How do you allow for someone to vote against the Constitution and the policies of the ANC, which is anti-discrimination?"

The new law allows both heterosexual and same-sex couples to register their unions either as marriages or civil partnerships. But in a concession to critics, it also allows civil officers to refuse to marry same-sex couples on the basis of conscience. Judge, the gay rights activist, predicted that this provision would be challenged in court.

"We can't be in the situation where civil officers can decide who they want to marry and who they don't want to marry," she said. "They aren't able to refuse to marry a black person and a white person. This is unconstitutional."

U.S. bishops offer guidelines

Roman Catholic bishops in the United States said Tuesday that gay men and women should be welcomed in the church but that those who engage in homosexual activity should not receive Communion, Reuters reported from Baltimore.

Guidelines adopted by the U.S. Conference of Catholic Bishops encouraged gays and lesbians to participate in the church, while reaffirming longstanding church doctrine that same-sex activity, as with any extramarital sex, is inherently sinful.

"Because homosexual acts cannot fulfill the natural end of human sexuality they are never morally acceptable," said Bishop Arthur Serratelli, who headed the committee that crafted the guidelines. "Such acts furthermore do not lead to true human happiness."

The church has publicly wrestled with the issue in recent years amid a widespread pedophile priest scandal and the national debate on gay marriage.

The new guidelines acknowledge that gays and lesbians do not choose their sexual orientation and say that homosexual "inclinations" are not in themselves sinful.

But those who feel such inclinations should remain celibate and should not tell anybody other than close friends and family about them, the document says.

The guidelines oppose same-sex marriages and civil unions and adoption by gay couples, though they say children of gay couples can be baptized.