Christopher Berkey for The New York Times

Merrill Lynch, one of the biggest brokerage firms on Wall Street, has agreed to pay $160 million to settle a racial bias lawsuit that wound through the federal courts for eight years, including two appeals to the United States Supreme Court.

The payout in the suit, which was filed on behalf of 700 black brokers who worked for Merrill, would be the largest sum ever distributed to plaintiffs in a racial discrimination suit against an American employer. Merrill, which was acquired by Bank of America after the suit was filed, also agreed to take advice from black employees on how to improve their chances of succeeding as brokers.

A spokesman for Merrill Lynch refused to confirm the terms of a preliminary settlement, which were provided by Linda D. Friedman, a Chicago lawyer who represents the brokers.

The pool of money, available to all black brokers and trainees at the firm since May 2001, is larger than those offered by other corporations sued by employees for racial bias, including Texaco and Coca-Cola, Ms. Friedman said. It also dwarfs recent payouts by other Wall Street firms, including $16 million that Morgan Stanley agreed to pay in 2008 to settle a suit brought by black and Hispanic brokers.

“This is a somewhat heroic story because these plaintiffs just kept fighting and fighting,” said John C. Coffee Jr., a professor at Columbia Law School. “This is like a triple-overtime win.”

Louis Lanzano/Associated Press

Among the many twists in the case was the admission in a deposition by Merrill’s first black chief executive, E. Stanley O’Neal, that black brokers might have a harder time because most of the firm’s prospective clients were white and might not trust their wealth to brokers who were not.

“We are working toward a very positive resolution of a lawsuit filed in 2005 and enhancing opportunities for African-American financial advisers,” Bill Halldin, a spokesman for Merrill Lynch, said on Tuesday.

When the suit was first filed in 2005, only about one of every 75 brokers at Merrill was black and most of them were considered poor producers. The lead plaintiff, George McReynolds, contended that black brokers received little help from their managers early on and were often ostracized by co-workers. The unequal treatment compounded their disadvantages year after year, he contended.

Mr. McReynolds, a longtime broker in Nashville, still works for Merrill eight years after taking the daunting step of suing his employer. Now 68, he said he hoped to fill a seat on the leadership council that Merrill has agreed to create to advise the firm on hiring and mentoring of blacks.

“It’s been a long journey,” Mr. McReynolds said in an interview last week. “There were a number of years where we didn’t know where it was going.” But, he added: “I never gave up. As long as it was alive, I thought we had a chance.”

He said some of his co-workers were wagering on the outcome of his case. “I found out they bet against me a couple of times,” he said.

For several years, his quest appeared quixotic. He hired Ms. Friedman, whose firm had pressed a class-action lawsuit against Merrill on behalf of brokers who were women who accused it of sex discrimination. Merrill resolved each of those women’s claims individually.

Ms. Friedman said that as many as 1,200 current and former Merrill employees could share in the racial discrimination payout. (As much as one-fifth of the money could go to the lawyers.)

But in the beginning, the only name on the lawsuit was Mr. McReynolds. Persuading colleagues to join him was complicated by how scattered Merrill’s black brokers were: despite a global network of 14,000 brokers, the firm did not have a single black broker in more than 25 states.

He knew how steep a climb he faced, but he said his resentment peaked when his three college-educated children told him that working at Merrill did not appeal to them.

“They basically said, ‘Dad, I couldn’t put up with what you have to put up with,’ ” Mr. McReynolds said. “I hoped they would be able to come on with me as a team and carry on what I’d been doing. But they could see things.”

Like most Wall Street firms, Merrill has been dominated by white men — its brokerage force was called the “Irish marines” — and its history is dotted with disputes about its acceptance of women and minorities.

In the 1970s, the firm settled a discrimination suit by consenting to make its work force more diverse but never met that goal. In 1998, Merrill settled another sex-discrimination class action by agreeing to a process for settling disputes with more than 900 women who filed claims.

Class actions are the only way around the custom on Wall Street of making all employees agree to resolve any disputes through arbitration. But to persuade a court to certify a class, the plaintiffs must prove that a sufficient number of workers are in a similar situation.

Mr. McReynolds and his lawyers gradually persuaded more brokers to sign on as representatives of the class. Early on, as the accusations in the case drew attention from the news media, Merrill executives rushed to hire more blacks into the firm’s training program and met with the plaintiffs to try to reach a settlement.

But those talks led nowhere, and the plaintiffs pressed on with their case, just as courts were making it harder for class actions to succeed. Colleagues were not making things any easier for the plaintiffs.

Frankie Ross, a 26-year employee of Merrill until he was fired last fall, recalled how a co-worker made copies of an article in The New York Times about the case and distributed them to everyone in the office.

“There was no need for him to copy the entire office in on that newspaper story,” said Mr. Ross, who said he was the only black broker who lasted more than a few years in his office.

All along, Ms. Friedman was arguing the brokers’ case in different federal courts.

Three years ago, a judge in Chicago denied their motion to be certified as a class. They appealed to the United States Court of Appeals for the Seventh Circuit, but were denied. That could have been the end of the road, especially after the United States Supreme Court ruled in 2011 against female employees of Wal-Mart who tried to sue the retailer for sex-discrimination as a large class.

“It was extremely painful and extremely difficult when we were losing battle after battle after battle,” Mr. Ross said. “Things were looking pretty bleak.”

Even though the Wal-Mart decision was considered a serious setback for class actions like the McReynolds case, Ms. Friedman went back to the Seventh Circuit last year.

She told a panel of three judges that Merrill’s practice of encouraging brokers to form teams and letting departing brokers hand off customers to other team members had a disparate effect on black brokers. Black brokers were rarely invited to join teams and were too widely scattered to form their own teams. By being left out, they were being left behind, Ms. Friedman argued.

In a decision that surprised many observers, an appellate panel accepted that argument and reversed the lower court’s denial of class certification. Merrill appealed that decision to the Supreme Court but was denied a hearing. A trial date was set for January 2014, but Merrill decided to settle rather than drag the fight on any longer.