A contentious, nine-day struggle to compose a global condemnation of racism was resolved Saturday when the World Conference Against Racism adopted a declaration denouncing the injustice of slavery and colonialism and recognizing the "plight" of Palestinians.

Conflicting attitudes toward human rights, ancient prejudices and ongoing political rivalry and unrest had threatened to torpedo the goals of the conference held over the past two weeks in Durban, South Africa, which had been ambitiously envisioned as a historic opportunity for the international community to map out a plan to fight racial discrimination around the globe.

But delegates to the conference could not seem to settle disputes over whether the U.S. should provide an apology and reparations for slavery and whether the document should condemn Israel for its treatment of the Palestinians.

Compromises on both issues were reached only Saturday morning, a day after the conference had been scheduled to end. Even as they accepted the compromise, Arab states registered their reservations that the gathering would not directly condemn Israel for its treatment of Palestinians.

The United States and Israel had abandoned the conference on Monday, after efforts by Norway to work out a compromise on the issue of the Middle East failed.

After the conference declaration and program of action were adopted about 4:40 p.m. Saturday, Australia and Canada said they were unhappy with the final documents' language on the Middle East conflict.

Earlier Saturday, South African Foreign Minister Nkosazana Dlamini-Zuma told the conference she understood there was agreement reached on the two issues, and the Islamic states issued a statement confirming this.

The conference apologized for slavery by declaring it a crime against humanity, saying it "should always have been so." It acknowledged the wrongs of slavery and colonialism and offered a package of economic assistance to Africa.

"We are happy we found a solution," Hans Winkler, an Austrian delegate, said.

It remained unclear what the new language would mean for European fears of potential lawsuits seeking reparations, though several European delegates said on condition of anonymity their fears had been addressed.

"It's certainly an issue that warrants further exploration," said Wade Henderson, a lawyer and executive director of the Leadership Conference on Civil Rights, a U.S. organization.

Negotiators from the European Union and African nations reached the agreement on reparations and the "crime against humanity" language about 4 a.m. Saturday morning, said South Africa's minister of public service, Geraldine Fraser-Moleketi.

They had reached agreement Friday to a compromise calling on those responsible for slavery to find ways to restore the dignity of victims. The statement amounted to an apology, said EU spokesman Koen Vervaeke.

But the EU had resisted calling the slave trade a "crime against humanity," though it was willing to condemn modern-day slavery as such a crime.

A copy of the compromise text, obtained by The Associated Press, said "slavery and the slave trade are a crime against humanity and always should have been so."

"The world conference, aware of the moral obligation on the part of all concerned states, calls on these states to take appropriate and effective measures to halt and reverse the lasting consequences of those practices," the text said.

Reparations, which were not directly linked to the slave trade in the document, would take the form of debt relief, opening of markets and poverty eradication efforts.

"Africa had a rendezvous with history," said Amina Mohamed, the Kenyan mediator in the talks. "We have an agreement on a document that is far from satisfactory, is terribly imperfect, but that provides a basis to build on, and I think, for the first time, the dignity of the black man has been recognized."

The deal on the Middle East was based on a South African compromise accepted Thursday by the European Union, but initially rejected by Arab states.

The proposal recognized the Holocaust and condemned anti-Semitism and Islamophobia and also expressed concern "about the plight of the Palestinian people under foreign occupation." It did not specifically criticize Israel or mention Zionism, the movement to establish and maintain a Jewish state.

But several Muslim countries then objected to efforts to delete additional text that many delegates felt indirectly referred to Palestinians, including a paragraph that said "foreign occupation ... is among the forms and sources of racial discrimination."

The conference rejected the efforts of those Muslim countries and passed the text by consensus, after debate pushed past a 4 p.m. deadline when translators had to return home.

The Arab states had called for the conference to condemn Israeli practices as racist. The European Union had refused to allow the conference to take sides in the conflict.

Islamic states said they had accepted the compromise, but still had serious reservations with its failure to address the Palestinian issue.

"Despite the fact that the text expresses concern about the plight of the Palestinian people under foreign occupation, it failed to condemn the discriminatory policies and practices of Israel," according to a statement by Organization of Islamic Conference.

"Regrettably, our repeated attempts to initiate negotiations on this issue ... have been thwarted by other parties," it said.

The conference's documents are not legally binding, but once adopted all countries promise to fulfill the applicable pledges made.

The Associated Press contributed to this report.