Rami plays Freddie Mercury in the Oscar-nominated Queen biopic, on which Bryan Singer served as director, until he was fired from the project with weeks to go before the end of shooting.
Last month, The Atlantic published an article in which four men accuse the director of having sex with them when they were underage, which he swiftly denied.
Speaking at the Santa Barbara International Film Festival, Rami said (via The Hollywood Reporter): “My heart goes out to anyone who has to live through anything like what I’ve heard and what is out there.
“It’s awful, it’s remarkable that this happens, I can appreciate so much what they’ve been through and how difficult this must be for them. In the light of the Me Too era that this somehow seems to exist after that, it’s a horrible thing.”
On his own experiences of being on set with Singer, the actor said: “I’ve sat here and talked about how everyone deserves a voice and anyone who wants to talk about what happened with Bryan deserves to have their voice heard.
“In my situation with Bryan, it was not pleasant, not at all. And that’s about what I can say about it at this point.
“For anyone who is seeking any solace in all of this, Bryan Singer was fired. Bryan Singer was fired, I don’t think that was something anyone saw coming but I think that had to happen and it did.”
Rami previously claimed he’d not been aware of rumours about sexual misconduct relating to Bryan Singer before they worked together on Bohemian Rhapsody, saying: “I didn’t know much about Bryan. I think that the allegations and things were, believe it or not, honestly something I was not aware of, and that is what it is.
“Who knows what happens with that … but I think somehow we found a way to persevere through everything that was thrown our way.”
Last month, the director referred to The Atlantic’s article as a “homophobic smear campaign”, denying the allegations detailed within it.
Bohemian Rhapsody is up for five awards at this year’s Oscars, including Best Actor for Rami Malek and the coveted Best Picture prize.