The United Nations secretary-general has used a speech ahead of the Winter Olympics in Sochi to condemn attacks on the LGBT community, amid growing criticism of Russia's so-called "gay propaganda" laws.

Ban Ki-moon, addressing the IOC before Friday's opening ceremony, highlighted the fact that the theme of the UN's human rights day last December was "sport comes out against homophobia".

"Many professional athletes, gay and straight, are speaking out against prejudice. We must all raise our voices against attacks on lesbian, gay, bisexual, transgender or intersex people," he said. "We must oppose the arrests, imprisonments and discriminatory restrictions they face."

"The United Nations stands strongly behind our own 'free and equal' campaign, and I look forward to working with the IOC, governments and other partners around the world to build societies of equality and tolerance. Hatred of any kind must have no place in the 21st century."

It emerged last week that more than 50 current and former Olympians have called on the IOC to uphold principle six of its charter, which forbids discrimination of any kind, and this week more than 200 writers added their voice to the protest against the new laws in a letter to the Guardian.

Ban did not refer specifically to Russia's new laws, which ban the promotion of "non-traditional" sexual relations to under-18s, but his words carry strong symbolic weight.

Speaking to reporters after his address, Ban, who is due to carry the Olympic torch and meet Putin in Sochi on Thursday, added: "I know there has been some controversy over this issue. At the same time I appreciate the assurances of President Putin that there will be no discrimination and that people with different sexual orientation are welcome to compete and enjoy this Olympic Games."

Asked about the new laws, the Russian deputy prime minister Dmitry Kozak insisted that there was no discrimination against anyone based on their "religion or their sexuality or their nationality". He said the new laws were to protect children.

"We are all grown up and every adult has his or her right to understand their sexual activity. Please, do not touch kids. That's the only thing. That's prohibited by law in all countries whether you are gay or straight."

Kozak also appeared to highlight an apparent inconsistency between the IOC and the Russian organisers over the issue. The IOC president, Thomas Bach, has said athletes should not protest against the issue on the medal podium but are free to speak out in press conferences.

But Kozak said: "Political propaganda is prohibited during the sporting event. It is prohibited by the Olympic charter not by Russian law."

He also referred to renewed security concerns sparked by reports that US homeland security sources had warned that terrorists might try to smuggle explosives aboard flights bound for Sochi in toothpaste tubes.

The department said later in a statement that it was not aware of any specific threat.

Kozak said the security threat in Sochi, which is protected by a "ring of steel" of 40,000 troops, police and security personnel, was no more serious than any major American city.

"I'm sure the security risk in Sochi is no more than in New York, Washington or Boston," he said, adding that the Russian security services were working with colleagues in the US and western Europe.

In December, suicide bombers killed 34 people in the Russian city of Volgograd, 400 miles north-east of Sochi. The attacks raised fears of further attacks during the Games.

A poll published by the Levada Centre, an independent Russian research organisation, this week found that 53% of those surveyed thought Russia was right to host the Olympics, 26% said the country should not have tried to do so and 21% were undecided. When asked what they saw as the main reason behind authorities' desire to hold the games, 38% said it was "opportunity for graft" and only 23% said it was important for national pride and to serve for the development of sport.

About half of respondents put the record price tag of the Sochi games down to corruption.

When asked about the survey during the press conference, Kozak said there was no evidence of "any large-scale corruption or theft" during the run-up to the Games, and that to say otherwise would "violate the democratic principle of presumption of innocence".