WASHINGTON (AP) – American Indians and black farmers will be paid $4.6 billion to address claims of government mistreatment over many decades under landmark legislation President Barack Obama signed Wednesday.

The legislation “closes a long and unfortunate chapter in our history,” Obama said. “It’s finally time to make things right.”

At a signing ceremony at the White House the president declared that approval of the long-delayed legislation “isn’t simply a matter of making amends, it’s about reaffirming our values on which this nation was founded: the principles of fairness and equality and opportunity.”

Obama promised during his campaign to work toward resolving disputes over the government’s past discrimination against minorities. The measure he signed settles a pair of long-standing class-action lawsuits. The measure also settles four long-standing disputes over Native American water rights in Arizona, New Mexico and Montana.

Elouise Cobell, a member of the Blackfeet Tribe from Browning, Mont., and the lead plaintiff in the Indian case, called the signing ceremony “breathtaking,” adding that she did not expect it to happen in her lifetime. Cobell filed the suit 14 years ago and led efforts to reach the $3.4 billion settlement a year ago and then push it through the House and Senate.

Cobell said she was driving her car in Montana when she learned the Senate had approved the measure last month. “I pulled over and I cried,” she said.

Even with Obama’s signature, the settlement must still go through a gauntlet of court hearings, a media campaign to notify beneficiaries, waiting periods for comments and appeals. The first check is not expected to reach tribal plaintiffs until August.

Even so, Cobell said the day was historic.

“This day means a lot to the elders, because it basically means they receive justice,” she said. “The money is secondary. They got justice. The United States government gave them justice.”

Sen. Blanche Lincoln, D-Ark., used similar language to describe the black farmers case, which marks the second round of funding from a class-action lawsuit originally settled in 1999. The case, which involves allegations of widespread discrimination by local Agriculture Department offices in awarding loans and other aid, is named after Timothy Pigford, a black farmer from North Carolina who was an original plaintiff.

The new settlement, totaling nearly $1.2 billion, is intended for people who were denied payments in the earlier settlement because they missed deadlines for filing. Individual amounts depend on how many claims are successfully filed.

“The time is long overdue to fund the discrimination settlement for farmers who have experienced decades of injustice,” Lincoln said.

The settlement will not erase the anxiety and frustrations many black farmers experienced, Lincoln added, but “it will help compensate their financial losses and begin laying the foundation in restoring their faith in the United States government.”

Some Republicans have warned that black farmers might make up stories of discrimination that are hard to prove. Rep. Steve King, R-Iowa, likened the program to “modern-day reparations” for African-Americans and argued that the claims process is rife with fraud.

Agriculture Secretary Tom Vilsack and Attorney General Eric Holder said the bill includes new safeguards to prevent fraud, including an extended court approval process and government audits.

Holder called fraud concerns “legitimate,” but he said the settlement rights a historical wrong.