SAN JOSE — In the latest blow to a football team rocked by off-field player misconduct allegations in recent years, Santa Clara County prosecutors Wednesday filed a misdemeanor sexual battery charge against San Francisco 49ers linebacker Ahmad Brooks over an incident with an intoxicated woman at a December house party.

Prosecutors also announced that a grand jury has indicted Brooks’ former teammate Ray McDonald on a felony rape charge involving the same woman after the party at McDonald’s San Jose home.

If convicted, Brooks, 31, could face up to six months in jail and have to register as a sex offender. Shortly after prosecutors announced the charges, the 49ers said they barred Brooks from participating in Saturday’s preseason game in Denver.

“We take any charge against a member of this organization seriously and are in communication with the NFL,” San Francisco 49ers General Manager Trent Baalke said in a statement. “Ahmad is returning home to California and will not participate in Saturday’s game.”

Lawyers for Brooks and McDonald were not immediately available for comment.

Brooks was expected to surrender to the sheriff’s department late Wednesday and post bail.

McDonald, 30, surrendered earlier in the day to the Sheriff’s Office and was released after posting $100,000 bail. He faces a maximum of eight years in prison if he is convicted of rape and would also have to register as a sex offender. The alleged incident occurred Dec. 15 after a pool party at McDonald’s home in the exclusive Silver Creek neighborhood in San Jose. He was set to be arraigned on the charges Sept. 25.

In December, the 49ers released McDonald, citing a “pattern of poor decision-making.” He was signed by the Chicago Bears, but in May, that team also let him go when he was arrested on domestic violence charges after a clash with his ex-finacee in Santa Clara while she was holding their infant child.

The indictments of McDonald and Brooks are the latest off-field legal developments involving 49ers players. Star linebacker Aldon Smith was released by the 49ers on Aug. 7 after his fifth arrest since 2012, this one for a purported hit-and-run drunken-driving accident. Fullback Bruce Miller pleaded no contest in June to a misdemeanor domestic-violence charge stemming from a March clash with his then-fiancee at a Santa Clara shopping plaza. Former cornerback Chris Culliver still faces prosecution on suspicion of hit-and-run. Wide receiver Jerome Simpson, an offseason signee, was suspended by the NFL for the first six games of the coming season — his third suspension in four years — for violating the league’s substance abuse policy while a member of the Minnesota Vikings.

Brooks has evolved into a two-time Pro Bowler in his 49ers tenure, making 28 sacks over the past four seasons as the starter at left outside linebacker. But the 49ers were aware as of May that Brooks was under investigation, as he was named in a civil suit regarding the incident. If the 49ers do not release Brooks, he could be asked to stay away from the team during the legal process, as they did with Miller.

The 49ers cannot suspend Brooks, per the collective bargaining agreement; that action only can be taken by the league. The league did not immediately return a message seeking comment.

Brooks had poised himself to take over at right outside linebacker in place of Smith.

Wednesday’s developments appears to be a vindication for the alleged victim, whom McDonald had sued for defamation of character after the 49ers released him shortly following the alleged incident. The defamation lawsuit was dismissed in June after the woman filed a counter suit, claiming the attack impaired her ability to work.

This is the second time Brooks has come to the attention of law enforcement in the South Bay. In June 2013, two eyewitnesses and then-teammate Lamar Divens told San Jose police that Brooks struck Divens in the head with a Heineken bottle three times. But the District Attorney’s Office declined to press charges, saying Brooks had a viable self-defense claim.

On Wednesday, no details were immediately available from District Attorney Jeff Rosen’s office on the charges against Brooks and McDonald. But sources familiar with the investigation have said at least some portion of the alleged assaults were caught on videotape by McDonald’s security system.

The grand jury also indicted McDonald for violating a May 27 domestic violence restraining order. That misdemeanor charge carries a maximum of one year in jail. The restraining order barred him from contact with his ex-fiancee and infant child.

However, the panel declined to indict McDonald in connection with the clash with his ex-fiancee and child two days earlier that had given rise to the restraining order. The District Attorney’s Office had charged McDonald with felony false imprisonment and other domestic violence misdemeanor charges but said Wednesday it will now dismiss that criminal complaint.

According to the woman’s lawsuit, she had no idea until she met McDonald that night at a Willow Glen bar that he was a professional football player. McDonald had claimed in his defamation lawsuit that the woman fabricated the allegations, seeking to exploit a national wave of similar incidents involving NFL players.

McDonald claimed the woman also lied to cover up that she had consensual sex “several times” with him that night and the next day.

But the woman’s suit lays out a completely different version of events. Contrary to media reports, she contends, she did not pass out from drinking but slipped and fell on a “negligently maintained, dangerously slippery deck” near McDonald’s swimming pool and struck her head, passing out for eight minutes. She also claimed the video shows that McDonald believed her to be dead. But instead of calling 911, she alleged, he told others at the party that he did not want a dead woman to be found on his property.

In her lawsuit, the woman contended that after passing out by the pool, she regained consciousness but fell several more times as a result of both the head injury and her alcohol consumption. It claims that while she was unconscious from one of those falls, Brooks groped her in a “sexual manner.”

Then, before she fully regained consciousness, McDonald carried her to his bedroom and had sex with her, she alleged. The woman’s suit does not mention whether the couple had sex the next day, though a police report in the case claims they did but notes she was not initially aware of what had happened while she was passed out.

Contact Tracey Kaplan at 408-278-3482. Follow her at Twitter.com/tkaplanreport.