The European Commission president has defended LGBT rights after a row erupted over the EU's refusal of grants to towns in Poland accused of discrimination.

"Our treaties ensure that every person in Europe is free to be who they are, live where they like, love who they want and aim as high as they want," said Ursula von der Leyen, in a tweet.

"I will continue to push for a #UnionOfEquality. #LGBTI," she added, using the abbreviation for lesbian, gay, bisexual, transgender and intersex that is associated with campaigns for equal rights for sexual minorities.

Ms Von der Leyen intervened in the debate after Polish officials protested the commission's decision to reject six Polish towns from taking part in a subsidised twinning programme.

Some municipalities in Poland set up so-called "LGBT-ideology free zones

The towns - which could otherwise have been eligible for small EU grants to support cultural partnerships with municipalities elsewhere in Europe - had declared themselves "LGBT ideology-free zones" or adopted "family rights" declarations that Brussels regards as discriminatory.

Poland's justice minister Zbigniew Ziobro denounced the decision as "illegal and without basis" and urged Prime Minister Mateusz Morawiecki to take the matter up with the European Commission to ensure that no more EU funding is cut in future.

But a spokesman for the commission, Stefan de Keersmaecker, told reporters that Brussels would continue to use the "tools at its disposal" to ensure that EU funds - including the far larger "cohesion funds" that Poland receives" are spent in line with the European Union's rules.

After concerns were raised in the European Parliament, the commission wrote to Poland in May to inquire about conservative local authorities setting up so-called "LGBT-ideology free zones".

The EU executive is working on a LGBT equality strategy that should be ready by the end of the year.