Rami Malek won his first Oscar on Sunday for his portrayal of late Queen frontman Freddie Mercury in musical “Bohemian Rhapsody.”

Malek, 37, had emerged as a favorite for the Oscar in recent weeks after winning Golden Globe, Screen Actors Guild and British BAFTA awards.

A Los Angeles native of Egyptian descent, Malek took on the role of Mercury, born to ethnic Parsi parents from India who moved their family to England when he was in his late teens.

Being neither a singer, dancer nor piano player, Malek did months of research and took voice, movement, piano and guitar lessons in order to capture Mercury’s accent, his strutting stage performances and the way he commanded a microphone.

The closing section of the film recreates almost move by move the Live Aid benefit concert in London where Queen played in July 1985.

Filmmakers used a combination of Mercury’s real voice, Malek’s voice and another singer against the band’s original recordings to showcase Queen’s hits. The soundtrack is so closely interwoven that Malek has said he cannot tell who is singing at any particular point.

Malek has said that getting the prosthetic for Mercury’s famously jutting teeth, which he started wearing a year before shooting the film, was key to his performance.

The film also documents Mercury’s personal battles, including his struggle with his sexuality and drug and alcohol use. In 1991, Mercury was one of the first British celebrities to die from AIDS, at age 45.

“Bohemian Rhapsody” was Malek’s biggest film role in a 15-year career as an actor. He was previously best known for playing the socially awkward hacker Elliot Anderson in TV series “Mr. Robot” for which he won an Emmy award in 2016.

Other television and movie roles include “Papillon” and “BoJack Horseman.”

Malek won the Oscar despite negative publicity around the film. “Bohemian Rhapsody” director Bryan Singer was accused of sexual misconduct involving underage men in the 1990s in an article published in January this year by The Atlantic magazine.

Singer, who was fired in 2017 towards the end of filming after clashing with some cast members, issued a statement denying the accusations. Malek has said he was not aware of the accusations against Singer while filming.