In a courtroom in San Francisco’s Hall of Justice, 102 prospective jurors squeezed into worn wooden seats, taking care to avoid the broken ones. They represented the mix of ages, races, sexual orientations and income levels that typifies their melting-pot city.

But another reflection of San Francisco stood out: Only four were black.

This pool, assembled last month, wasn’t unusual. The shrinking of the African American population in big cities like San Francisco — which saw a decline from 12.7 percent to 5.7 percent between 1980 and 2015 — is prompting growing concern that black defendants are being denied their right to a trial in front of a jury of peers.

“It’s not uncommon that you’ll walk into a felony trial with an African American client and turn around and see anywhere from zero to maybe three African Americans in the whole jury pool,” said San Francisco Deputy Public Defender Manohar Raju, who manages the office’s felony unit.

“The chances of someone of the same race as your client getting onto the jury is pretty small,” he said, “which is a problem in terms of the jury’s ability to understand your client’s reality.”

In a six-month span in 2016, attorneys with the public defender’s office said they counted at least six trials in which not one prospective juror was African American.

If this is a problem, there are no easy answers. In San Francisco, 39 percent of suspects booked into jail last year — and 51 percent of defendants represented by public defenders — were black. But courts are not required to ensure that a defendant’s race is reflected in a jury. And a defendant challenging the composition of a jury must prove that the prosecutor or judge intentionally discriminated against a racial group during jury selection.

Some defense attorneys and others, though, are pushing for the justice system to take a first step by studying the issue, tracking the race, gender, age and sexual orientation of jurors.

This month, state Sen. Scott Wiener, D-San Francisco, introduced SB576, which would require jury commissioners to collect demographic data from all prospective jurors — information that would be publicly available.

“I’ve seen firsthand the impact that the racial composition of a jury can have,” said Wiener, a former deputy city attorney and city supervisor. “In order to address this challenge, we need to have good data. Let’s collect that data, see how deep the problem is and then we can move forward with a solution.”

Some counties in California already collect such information in some form — Contra Costa County, for example, began collecting jury data for two months each year in the early 2000s — but most do not.

In San Francisco, the Superior Court draws from Department of Motor Vehicles and voter registration records to fill jury pools, said Ann Donlan, a spokeswoman for the courts. She declined to comment on jury diversity and on why the court does not collect demographic data, but said, “It has always been the court’s goal to have a jury selection process that is fair and inclusive.”

Max Szabo, a spokesman for the district attorney’s office, also declined to discuss the makeup of juries and the effort to study it, but said, “We continue to pursue data-driven solutions to enhance fairness in the criminal justice system.”

Wiener’s bill comes at a time when racial disparities in jails and prisons, and in the way police use force, have drawn increasing scrutiny from advocates, researchers and the general public.

Defense attorneys say these disparities may be exacerbated by jurors influenced by stereotypes. Raju said some jurors may not empathize with a black defendant whose background is different from theirs.

“There are a lot of people in certain neighborhoods who walk around with a weapon, not because they want to hurt someone but because they are genuinely afraid,” he said. “They’ve seen their cousins and friends getting killed, and people who grow up in those communities understand that. But if you haven’t grown up in that kind of community, a lot of the assumptions that people bring in are that if you’re carrying a knife or if you’re carrying a gun, you’re instigating, you’re intending to hurt someone.”

Raju said attorneys in his unit have represented several clients who spoke of feeling more inclined to take a plea deal after they saw the makeup of the jury pool and concluded they wouldn’t get a fair trial.

The makeup of a jury can mean the difference between a conviction and an acquittal, according to a 2011 university study published in the Quarterly Journal of Economics that looked at 10 years of felony trials in Florida’s Sarasota and Lake counties.

In cases with no African Americans in the jury pool, black defendants were convicted at an 81 percent rate and white defendants at a 66 percent rate. When a jury pool included at least one black person, the gap in conviction rates was closed, with black defendants convicted 71 percent of the time and white defendants 73 percent of the time.

“Race matters in a courtroom,” said Samuel Sommers, a Tufts University psychology professor who studies how race relates to perception and judgment. “There is nothing about taking an oath as a juror that renders us immune from the biases that affect us on a daily basis.”

He said the constitutional requirement that a jury pool be drawn from the community leaves open a question: “What do you do when you’re part of an underrepresented group that’s living in that community?”

San Francisco Deputy Public Defender Kwixuan Maloof said that in one murder case in 2010, a jury with a single African American member could not come to a consensus on a verdict for a black defendant, forcing a mistrial. But a second group with no black jurors convicted him after prosecutors refiled charges.

When Maloof questioned the panel members informally after the trial, he said, they seemed fixated on the way the defendant presented himself in court and his speech, particularly the way he kept pronouncing “heroin” as “heron.”

“It was like they lost focus on the issue,” Maloof said.

Those pushing for the collection of jurors’ demographic data say the real challenge will be finding solutions to the racial disparity.

Hiroshi Fukurai, a UC Santa Cruz sociology professor and author of the book, “Race and the Jury,” said one area of attention is likely to be the rate at which people fail to show up for jury service. He said courts may need to offer more incentives, as many people in less wealthy communities work hourly jobs and can’t afford to fulfill their civic duty.

An ACLU study of a sampling of Alameda County jury pools, conducted in 2010, found that African Americans represented 18 percent of the jury-eligible population but accounted for 8 percent of those who showed up. Latinos made up 12 percent of the population and 8 percent of the jury pools.

Historically, Fukurai said, some courts have set quotas for jurors who fit a similar ethnic and racial background to the defendant. For centuries, Jews charged with crimes in England could demand that half the jury be composed of fellow Jews, while Northeastern U.S. states used such split juries for cases involving Native Americans until the end of the 19th century.

Under the law, today’s courts have the authority to ensure that juries are racially representative of the community, Fukurai said — if they have the will. He said such an act could be as simple as judges granting defense motions to replace a nonrepresentative jury pool with a new one, or drawing prospective jurors from specific ZIP codes.

“A law is something that is alive; it’s not static,” Fukurai said. “It depends on the history, situation, reality. ... The courts reflect the social milieu. They should be in the position to take into consideration the importance of race in trials, especially for racially sensitive cases.”

Another option is to draw from a wider list of potential jurors, using such records as utility bills, instead of relying on voter registration and DMV records, said Oscar Bobrow, a Solano County deputy public defender who worked with Wiener on the data-collection legislation.

The questions raised by the loss of black jurors in San Francisco were underscored in a high-profile case last year. Michael Smith, a 23-year-old black man, was charged with resisting BART police officers who had taken him and his pregnant girlfriend to the ground after receiving a false report that Smith had a gun.

Ultimately, a jury with no African Americans acquitted Smith of four criminal counts and couldn’t agree on four other charges that prosecutors later dismissed. After the verdict, San Francisco teacher John Mayhew, who is white, said he believed the case was rife with racial undertones that many of his fellow jurors failed to comprehend.

Mayhew said black students he had taught had told him of their fear of police. And he said he understood the historical significance of Smith’s situation: In 2009, an unarmed BART rider, Oscar Grant, was fatally shot by a transit agency officer after being taken to the ground at Fruitvale Station in Oakland.

“I don’t think too many people on the jury fully understood” the context of the case, Mayhew said in an interview.

“Somebody had to speak up for this African American man, but there were no African Americans on the jury,” he said. “Michael Smith was lucky. But there are not a lot of other people who are willing to step into the shoes of somebody else.”

Vivian Ho is a San Francisco Chronicle staff writer. Email: vho@sfchronicle.com Twitter: @VivianHo