The Lord of the Rings star joined 27 Nobel Laureates in writing an open letter to Russian President Vladimir Putin asking him to change a controversial law banning "homosexual propaganda".
Sir Ian McKellen
Leading figures including novelist JM Coetzee have signed the letter, which was devised by Sir Ian and chemist Sir Harry Kroto, and published in the Independent.
Geneticist Sir Paul Nurser and 1976 Nobel Peace Prize winner Mairead Maguire have also put their name to the document, which Sir Ian has signed "AKA Henry V/Gandalf".
"This letter is written to indicate that many senior members of the international scientific community show solidarity with politicians, artists, sports people and many others who have already expressed their abhorrence for the Russian government's actions against its gay citizens," the letter states.
Sir Ian and his friend Sir Harry Kroto devised the letter
"Protest is never easy but we hope that by expressing opposition to the new legislation it might be possible to encourage the Russian state to embrace the 21st century humanitarian, political and inclusive democratic principles which Mikhail Gorbachev worked so hard to achieve."
Sir Ian, a spokesperson for Lesbian, Gay, Bisexual and Transgender (LGBT) rights, revealed last month that he turned down offers to appear at Russian film festivals after the UK Foreign Office advised him not to speak openly about his sexuality while in the country.
The Russian law makes it illegal to promote "non-traditional sexual relations to minors", which activists say prevents parents and teachers offering support to gay youths.
Stephen Fry and Madonna are among the stars who have spoken out against the law
The letter was published days before the Winter Olympics gets underway in the Black Sea resort of Sochi, Russia. Mr Putin has faced international hostility over the legislation - President Barack Obama selected a US delegation for the games that includes openly gay athletes Billy Jean King, Caitlin Cahow and Brian Boitano.
Celebrities including Stephen Fry and George Takei have publicly called for a ban on the event, while Kristen Bell, Madonna and Jonah Hill are among those who have spoken out against the Russian law, which was passed in June 2013.