Bill Cosby feels R. Kelly "got railroaded" in his sex-trafficking trial that ended Monday with convictions on all nine counts against him, according to the newly freed comedian’s rep.

Cosby believes the pervy singer "was screwed" and that "he wasn’t going to catch a break" during the month-long trial, according to his spokesman, Andrew Wyatt.

Wyatt shared Cosby’s thoughts in a Tuesday night interview with The Post, where the rep said Kelly never stood a chance and railed against the ’90s R&B superstar’s defense team.

"The deck was stacked against Robert," said Wyatt. "His constitutional rights were grossly abused. I don’t know anywhere but in this country in the United States that a documentary can bring criminal charges against someone."

R. KELLY GUILTY VERDICT BRINGS LONG-OVERDUE JUSTICE TO PREDOMINANTLY BLACK FEMALE VICTIMS

"No one fought hard for him," and his attorneys didn’t "humanize him," Wyatt said.

Bill Cosby (R) called R. Kelly's (L) conviction wasn't fair. 

Bill Cosby (R) called R. Kelly's (L) conviction wasn't fair.  (Frank Micelotta/Invision/AP/Gilbert Carrasquillo/Getty Images)

"He also didn’t have the resources and means, he should have asked for support from the court. He would have gotten better representation," added Wyatt.

"This is a guy who made the song ‘I Believe I Can Fly’ when there were rumors about young girls. The song played at every wedding and in every church. He was doing music with Lady Gaga!" said Wyatt.

R. KELLY 'CAN BE REDEEMED,' REP. DANNY DAVIS SAYS

Kelly, 54, was convicted of sexually abusing women and children for decades on counts including racketeering and violations of the Mann Act, which prohibits the transport of people across state lines for an immoral purpose.

He faces 10 years to life in prison at his sentencing next May.

Cosby, meanwhile, had been convicted of sexually assaulting Andrea Constand in April 2018. But the 84-year-old served just 2.5 years behind bars before his conviction was unexpectedly overturned in July and he was set free.

BILL COSBY’S SEX ASSAULT CONVICTION OVERTURNED BY PENNSYLVANIA COURT

Pennsylvania’s Supreme Court found the district attorney back in 2005 had made a secret agreement with Cosby that he wouldn’t be criminally charged if he copped to what he had done.

The court ruled in July that the new DA was bound by that verbal agreement.