LOS ANGELES — Rami Malek has won the best actor Oscar for his portrayal of rock star Freddie Mercury in the Queen biopic "Bohemian Rhapsody." The 37-year-old star also won the SAG-AFTRA and British Academy prizes for the performance.

"We made a film about a gay man, an immigrant, who lived his life just unapologetically himself," Malek said during his acceptance speech. "The fact that I'm celebrating him and this story with you tonight is proof that we're longing for stories like this."

#Oscars Moment: @ItsRamiMalek accepts Oscar for Best Actor In A Leading Role for his portrayal in @BoRhapMovie. pic.twitter.com/PwmrYI35WN — The Academy (@TheAcademy) February 25, 2019

"I am the son of immigrants from Egypt, a first-generation American," he went on. "And part of my story is being written right now. And I could not be more grateful to each and every one of you, and everyone who believed in me for this moment. It's something I will treasure for the rest of my life."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The win comes at the end of a season marred by controversy surrounding the film. Director Bryan Singer was fired by 20th Century Fox with mere weeks left on the schedule, reportedly due to his consistent failure to show up on set. Director Dexter Fletcher ("Rocketman") was brought in to complete the film.

An image of Freddie Mercury appears on screen as Adam Lambert and Brian May of Queen perform. Chris Pizzello / AP

"It all raised my game in a way," Malek told Variety's "Playback" podcast of the on-set atmosphere. "I wasn't completely jarred by the whole thing. I actually got a little bit of rest before Dexter came in. We had Tom Sigel, who I don't think has got enough love. He is an incredible DP and I thought, 'If we lose our DP, then we're going to have a problem,' because he had such a cohesive vision."

Singer also continues to be dogged by sexual assault allegations, the latest of which surfaced in January.

Malek's victory marks the 12th time in 17 years that the lead actor Oscar has gone to the star of a biopic. Recent winners have included Gary Oldman ("Darkest Hour"), Eddie Redmayne ("The Theory of Everything") and Matthew McConaughey ("Dallas Buyers Club").

"Bohemian Rhapsody" also won Oscars for film editing, sound editing and sound mixing.

FOLLOW NBC OUT ON TWITTER, FACEBOOK & INSTAGRAM