After Bill Cosby was sentenced to prison on Tuesday, his defense team made fiery accusations of racism and sexism in statements outside the courthouse, framing their client’s downfall as an unjust product of the #MeToo era.

Speaking under an umbrella in pouring rain, Mr. Cosby’s publicist, Andrew Wyatt, said his client’s defeat was part of the “sex war” happening in Washington, comparing it to accusations of sexual misconduct against Judge Brett M. Kavanaugh that are roiling the capital.

Mr. Wyatt said that Mr. Cosby, once a beloved actor and comedian, had endured the “most racist and sexist trial” in the country’s history.

On Tuesday, Mr. Cosby, 81, was sentenced to three to 10 years in prison for drugging and sexually assaulting a woman, Andrea Constand, at his home outside Philadelphia in 2004. Judge Steven T. O’Neill also ruled that Mr. Cosby qualified as a “sexually violent predator” under state law.