Hungary broke European law by restricting foreign funding of civil society organisations, the EU's top court has ruled.
A Hungarian law of 2017 requires NGOs that receive funding from abroad to register as "foreign-supported organisations" and publish donor names.
The European Court of Justice (ECJ) said the restrictions were discriminatory against NGOs and donors.
Hungary says it is countering money-laundering and boosting transparency.
Hungary's Prime Minister Viktor Orban has long been engaged in a feud with the Hungarian-American billionaire philanthropist George Soros, and has accused NGOs funded by Mr Soros of interfering in domestic politics.
The law stipulates that categories of NGOs that receive more $27,000 (£21,600) of foreign funding per year have to register as such and publish the names of donors.
"Hungary's restrictions on the funding of civil organisations by persons established outside that member state do not comply with the Union law," the European Court of Justice said in a statement.
According to the ECJ, the law restricts the free movement of capital - one of the four founding principles of the European Union - because it "establishes a difference in treatment between national and cross-border movements".
Critics of Mr Orban say the law was intended to silence opposition.
Mr Orban, a nationalist and conservative, and his ruling Fidesz party, which holds an outright majority in parliament, are accused of wielding power in increasingly authoritarian ways.
EU leaders have repeatedly raised concerns about Mr Orban's government. A group of 13 member states expressed "deep concern" over the extraordinary powers introduced in March to combat the coronavirus, saying they could threaten "democracy and fundamental rights".
Hungarian lawmakers voted in favour of repealing those powers on Tuesday.
But opposition groups fear Mr Orban's administration has greatly expanded its powers amid the outbreak.