The protesters attempted to rally outside the Russian State Duma before what is expected to be a final vote on the bill banning "propaganda of nontraditional sexual relations."
Police moved in after supporters of the bill started showering the protesters with eggs and water. Some of the protesters who were not detained were viciously attacked by masked men on a central street a mile away.
The Kremlin-backed legislation imposes hefty fines for providing information about the lesbian, gay, bisexual and transgender community to minors or holding gay pride rallies.
Russia is also considering banning citizens of countries that allow same-sex marriage from adopting Russian children.
Lawmakers changed the wording of "homosexual propaganda" to "propaganda of nontraditional sexual relations," which backers of the bill define as "relations which are not conducive to procreation."
Breaching the law carries a fine of up to 5,000 rubles ($156) for an individual and up to 1 million rubles ($31,000) for media.
Earlier Tuesday a dozen anti-gay activists picketed the Duma. One of them held a poster that read: "Lawmakers, protect the people from perverts!"
The bill has been seen as Putin's attempt to consolidate his support base which includes many conservative Russian Orthodox voters.
Russian and foreign rights activists have decried the bill as violating basic rights. Human Rights Watch on Monday said the bill would "infringe Russian citizens' freedom of expression and information, and discriminate against Russia's LGBT community."
Russian officials have rejected criticism. Foreign Minister Sergey Lavrov defended the bill in February, saying that Russia does not have any international or European commitment to "allow propaganda of homosexuality."
Russia decriminalized homosexuality in 1993 but anti-gay sentiment is still high.
Copyright 2013 The Associated Press.