Picture: Screenshot

A homophobic video urging Russians to re-elect President Vladimir Putin has gone viral less than a month before the country's election.

The video, which appeared on social media on Friday, tells voters that if Putin's rivals win they will take Russia into a "nightmare" future in which they are forced to co-habit with gay men.

The video stars well-known screen actors but it was unclear who published it.

It has had more than three million views on the Facebook page of pro-Kremlin political analyst Alexander Kazakov.

In it, a middle-aged man dreams of a future without Putin, who is expected to win a fourth term in the March 18 vote.

In one of them, the character sees a gay man sitting in his kitchen filing his nails and eating a banana suggestively.

One of Putin's election rivals, liberal candidate Ksenia Sobchak, has called for Russia to allow gay marriage -- an unlikely prospect in a socially conservative country.

Some observers have suggested that Sobchak's candidacy was part of a strategy to create a semblance of diversity in an election that Putin is all but certain to win.

She has denied being a "Kremlin project."

Sobchak spoke out against the video on Monday, condemning it as "vile".

"Presenting LGBT people as a threat in a homophobic country is no joke," she wrote on Instagram.

Homophobic attitudes are widespread in Russian society and no mainstream public figures have come out as gay.

Russian legislation makes it illegal to present homosexual relationships in a positive way to minors.