The European Union's highest court has ruled that Britain's can withhold some child benefits from foreign EU workers living in the United Kingdom.

The European Court of Justice said Tuesday that even though it amounted to indirect discrimination, it said Britain had a right to protect its finances.

The issue had been a debating point in the EU referendum campaign in Britain with many complaining that Britain should not pay child benefits to EU workers whose children live on the continent.

The EU's executive Commission had brought action against Britain since it considered withholding certain benefits for EU citizens amounted to discrimination.