SAN JOSE — An African-American student has sued two San Jose State basketball coaches, claiming they barred him from playing in games and practices after he complained about allegedly homophobic remarks and racially discriminatory treatment.

The lawsuit was filed Monday in federal court in San Jose against San Jose State University and the two coaches on behalf of former student player Gary Williams Jr., seeking unspecified damages.

San Jose State spokeswoman Patricia Lopes Harris said the university would not comment because it its a personnel matter.

The head coach named in the lawsuit, David Wojcik, resigned for “personal reasons” in July, following an investigation by the university into his alleged conduct. It was not clear Tuesday whether his departure after leading San Jose State’s most successful team in six years was directly related to the allegations made by Williams Jr. and corroborated in some cases, according to the investigation report, by other players.

However, the university’s investigation concluded that Wojcik had sexually harassed players repeatedly by questioning their manhood, using derogatory terms such as “butt buddies,” curse words and unflattering comparisons to female genitalia, according to the investigation report and the lawsuit. None of the players were gay, but the university said many on the team considered the frequent comments homophobic and offensive.

The lawsuit also contends that the director of basketball operations, Ryan Cooper, told Williams on July 9 that the unversity was going to make a decision on Wojcik’s status soon. Wojcik submitted his resignation on July 10. He could not be reached for comment. Williams’ lawyer declined to comment.

The litigation is the latest development in what Williams’ attorney, Frank S. Moore, characterized as a “long record of strained racial relations” at the school. Last year, for instance, a jury in San Jose found three white freshmen guilty of misdemeanor battery on a black suitemate in 2013, though the panel did not reach guilty verdicts on more serious hate-crime charges.

The university settled that lawsuit for $225,000, spokeswoman Lopes Harris said.

The hazing during the fall 2013 semester led the college to launch the Office of Diversity, Equity and Inclusion.

It also sparked an internal investigation, an apology from the president of the university — where blacks make up about 3 percent of the student body — and the creation of a campus task force on racial discrimination.

The other person named in the suit is then-assistant basketball coach Tyler Ojanen, who now works as director of San Jose State’s Olympic Sports Operations and could not be reached for comment.

Williams, whose nickname is G-Will, graduated in 2012 from Castlemont High School in Oakland, where he was a first-team All-Oakland Athletic League point guard and senior class president. He played two seasons for the Spartans as a junior college transfer from Indian Hills Community College in Ottumwa, Iowa. Wojcik, who was paid about $325,000 a year, recruited him from the community college, where he was on the dean’s list and also voted “fan favorite.”

The lawsuit claims that Wojcik treated white players differently than black players, denigrating the black students as “retarded” and asking if they were slow or “smart enough to remember the play.”

Williams also alleges that he let a white player in November 2016 play in a nationally televised game against St. Mary’s, even though the young man was returning to the team after being suspended for using cocaine. The lawsuit contends that Wojcik covered up the suspension, filing false reports that he had been injured. In contrast, five black players were suspended in December 2014 for using marijuana, and two were expelled.

He also mocked Williams, who is Christian, for praying with the team before the game and prior to him taking a free throw. Wojcik denied doing so, according to the university’s investigation report.

In the 2016-17 season, Williams played in 21 games and made nine starts, averaging 7.1 points and 2.6 rebounds. He also scored 14 points in just seven minutes of action on the road at Boise State.

The season before, he played in 30 games, made four starts as a point guard and was the team’s top free-thrower at 84.4 percent. Among other dramatic moments, he scored 10 of his season-high 18 points in the final five minutes of the Spartans’ victory over Wyoming and made six consecutive free throws to ice the Spartans’ first Mountain West win.

The lawsuit alleges that after he spoke up at a team meeting about the head coach’s allegedly abusive conduct, Wojcik retaliated by frequently benching him. During the most recent season, he played 37 percent less than the season before.

In a news release Wojcik released in July, he described his state of mind.

“This past year has been emotionally challenging for me with the loss of my father. His passing made me evaluate what is important in life and the value of family. With the considerable needs of my widowed mother as well as my son moving to the East Coast after his high school graduation, I believe it is the appropriate time to resign my position as head men’s basketball coach at San José University,” he said.