NEW YORK (AP) — A jury of seven men and five women was selected Friday for Harvey Weinstein’s rape trial after an arduous two-week process, setting the stage for testimony to begin in the next week.

The final tally mostly erased a gender imbalance that, just hours earlier, led to complaints by prosecutors that the defense was deliberately trying to keep young women off the panel.

“They are systematically eliminating a class of people from this jury,” prosecutor Joan Illuzzi-Orbon said.

The defense said it wasn’t specifically targeting young women, but didn’t want jurors who were too young to understand the way men and women interacted in the early 1990s.

“That was a different time in New York and on planet Earth,” Weinstein attorney Arthur Aidala said.

Weinstein, 67, ambling out of the courthouse, didn’t comment when asked his thoughts on jury selection. “Ask Donna!” he said, referring to lawyer Donna Rotunno. Three alternate jurors — one man and two women — were also seated who will sit through the trial and take the place of any jurors on the main panel who can’t make it through to deliberations.

Weinstein, the former studio boss behind such Oscar winners as “Pulp Fiction” and “Shakespeare in Love,” is charged with raping a woman in a Manhattan hotel room in 2013 and sexually assaulting another woman in 2006. He has pleaded not guilty and said any sexual activity was consensual. If convicted, he could face life in prison.

The tussle over juror gender comes amid a selection process that has been far from easy.

Weinstein’s case has attracted widespread public attention and catalyzed the MeToo movement as dozens of women have come forward over the last two years with allegations of sexual misconduct. That’s made it tough for Weinstein’s lawyers, prosecutors and Burke to find a fair and impartial jury.

Each day for nearly a week, whenever Judge James Burke introduced Weinstein to a new batch of potential jurors and asked if they couldn’t be impartial, dozens of hands shot up.

Weinstein’s lawyers have tried, so far unsuccessfully, to move the trial out New York City, arguing that the media hub where celebrities and ordinary people often intersect can’t possibly give Weinstein a fair trial.

Cognizant of the media attention and the weight some people are putting on the case, Burke has cautioned potential jurors: “This trial is not a referendum on the #MeToo movement.”

Of more than 600 people summoned as potential jurors in Weinstein’s case, some have marked themselves for disqualification by admitting they knew one of Weinstein’s many accusers, had personal experience with sexual abuse or read “Catch and Kill,” a book by Ronan Farrow, one of the first reporters to bring the allegations against Weinstein to light.

There were others like supermodel Gigi Hadid, who reported for jury duty and wound up in the Weinstein pool, who even said they had met the defendant. One man’s wife starred on a show that Weinstein’s studio produced and said he couldn’t be impartial. One woman said she couldn’t be impartial because she has a “close friend who had an encounter with the defendant in his hotel room.”

Another man was scratched for saying he couldn’t be fair-minded because he had often spotted Weinstein in Tribeca, the lower Manhattan neighborhood that hosts an annual film festival. “On several occasions I’ve seen him on the phone screaming at someone,” he said of Weinstein.

In the end, the jury includes the author of a upcoming novel that she describes as involving young women dealing with predatory older men. The defense, out of challenges, argued against including her on the jury, but Burke said she could serve. The defense then asked for a mistrial over her inclusion on the jury but was denied. Weinstein lawyer Rotunno said the woman had lied on her jury questionnaire, but prosecutors noted she disclosed on the form that she was a novelist.

That so many people in the running to be on the jury have had experiences involving Weinstein or his accusers speaks to the breadth of his alleged abuse, as well as the ubiquitous nature of celebrity in New York, where stars are frequently spotted by paparazzi and the public alike riding the subway, shopping for groceries and walking their pets.

Then there have been other issues, including at least one instance of what jury consultants call “stealth jurors” — people eager to serve, especially on a high-profile case, because they hope to make a point, or a profit.

On Thursday, Burke threatened to hold a potential juror in contempt of court for asking his followers on Twitter “how a person might hypothetically leverage serving on the jury of a high-profile case to promote their new novel.”

Opening statements are expected next Wednesday. The trial could last about six weeks.

While Weinstein’s celebrity was behind some of the difficulties in finding an impartial jury in this case, they also stemmed from the fact that the MeToo movement has Americans thinking more than ever about their own experiences with sexual harassment and assault.

“A lot of folks who will be incapable of separating their own workplace experiences from the case … and might not even recognize that they’re bringing their own prejudice, if you will, to bear on the circumstances,” said jury consultant Philip K. Anthony. “It’s not bad on their part — it’s just human nature.”

Anthony’s Los Angeles consulting firm is not involved in Weinstein’s case.

During the phase of jury selection called voir dire, where lawyers attempt to size up people who have assured the judge they could be fair and impartial jurors, the lawyers’ concerns were in evidence. Addressing a pool of prospective jurors Thursday, prosecutor Meghan Hast signaled concerns that the sight of Weinstein, who’s been using a walker since back surgery last month, could influence their attitudes about him.

“Is there anything about Harvey Weinstein, looking at him today, that makes you feel that there’s no way that man’s a rapist?” she asked. No one responded.

Defense lawyer Damon Cheronis told the panel that they would hear testimony from Weinstein accusers who might get emotional and cry on the witness stand. He also asked the potential jurors whether they were familiar with the concept of “victim shaming.”

Another one of his questions: “Does anybody think an individual could have sex with someone that they may not find attractive for reasons other than love?” No one responded.

Prosecutors plan to call at least four women to the witness stand who have accused Weinstein of violating them, but whose allegations weren’t the basis for the New York charges.

As jury selection was getting underway last week, California prosecutors charged Weinstein with sexually assaulting two women there, one of whom who is expected to testify in the New York case.

Burke ruled Friday that if Weinstein testifies on his own behalf, prosecutors can’t question him about that accuser on cross examination.