* If enacted, law is likely to harm relations with EU
* Moves comes ahead of a parliamentary election on Oct.28
* Rights activists say it is discriminatory
KIEV, Oct 2 (Reuters) - Ukraine's parliament on Tuesday took a first step to making the promotion of homosexuality a criminal offence punishable by prison despite appeals from local and foreign human rights groups who said the move was discriminatory.
The draft law, which passed the first of two readings, does not clearly define what it means by the "promotion of homosexuality" but says it is a threat to national security.
"Certain media outlets, going against the interests of society and the state, are promoting a tolerant attitude towards things like sexual relations between people of the same sex," the law's authors said in an accompanying note.
"The spread of homosexuality constitutes a threat to national security as it leads to an HIV/AIDS epidemic and also destroys the institute of family and can trigger a demographic crisis."
If the law is enacted - something that would also require President Viktor Yanukovich to sign off on it - Ukraine's criminal code would be amended to punish anyone convicted of importing, producing or spreading "works that promote homosexuality" with jail terms of up to five years.
Such legislation would be likely to further strain Ukraine's relations with the European Union which has shelved a landmark association agreement with Kiev over concerns about a seven-year prison sentence handed down to opposition leader Yulia Tymoshenko.
However, opinion polls suggest the law would be popular with voters ahead of an Oct.28 parliamentary election.
Homosexuality itself has been legal in Ukraine since the fall of the Soviet Union, of which it was part, in 1991.
But a 2011 poll conducted by the Gorshenin Institute, a local think tank, showed that 78 percent of Ukrainians viewed homosexuality negatively, making a law against its promotion a potentially useful tool in the election campaign.
"This law's motto is 'Taboo on homosexuality in the media," said Svyatoslav Sheremet, the head of Gay Forum of Ukraine, a non-governmental organisation.
Sheremet was beaten up by several masked men on May 20, when he and others were forced to cancel their first planned "Pride" march after hundreds of anti-gay activists showed up.
According to New York-based group Human Rights Watch, the draft law institutes discrimination based on sexual orientation and is "the outcome of stereotypical views on homosexuality".
"By restricting the publication and dissemination of materials related to sexual orientation and gender identity, this bill would severely restrict access to information about health, support networks, or social activities for countless young people," HRW said in a statement in June.
Ukraine's parliament, which is in its last session before the Oct. 28 election, scrapped another law in July which would have barred all public activities promoting homosexuality, such as "Pride" marches.
Sheremet said the new bill was certain to be condemned in the West.
"U.N. agencies, the Council of Europe and the European Union will assess this discriminatory bill," he said.
"I am sure that respected international experts will explain why the whole idea of banning the 'promotion of homosexuality' in Ukraine has no right to be backed legally." (Reporting by Olzhas Auyezov and Natalia Zinets; Editing by Andrew Osborn)