As part of its outreach to the Hungarian diaspora, Budapest has set up a host of charities and foundations to provide financial and other support. The most visible of these, the Egan Ede Foundation, has provided thousands of ethnic Hungarians living in western Ukraine with cash grants to support their businesses.

In response, Ukraine’s internal security agency, known as the S.B.U., recently opened a criminal case against the foundation for promoting separatism.

Mr. Babek, Berehove’s mayor, said the real problem is not that Hungary offers so much financial and other help, but that Ukraine offers so little. When the town wanted to erect a statue to a revered Ukrainian writer, Taras Shevechenko, it spent years trying to raise money in Ukraine; it eventually got the bronze tribute finished after Hungary agreed to cover half the cost.

The biggest beneficiary of Hungarian money in Berehove is the Ferenc Rakoczi II Transcarpathian Hungarian Institute, which occupies the town’s largest building, a grand former courthouse built during the Austro-Hungarian Empire. The institute’s rector, Idiko Orosz, had nothing but praise for Mr. Orban, who visited the institute in 2013 and pledged financial support, and for his Fidesz party. “It supports us so we support it,” she said.

She is particularly grateful to Fidesz for its help in protesting restrictions on the use of languages other than Ukrainian. Hungarian-speakers living in Ukraine, she said, are not like the foreign immigrants whom Mr. Orban rails against constantly in Hungary, but are more like Native Americans who suddenly found their homeland taken over by strangers.

“We stayed at home; they came to us, not us to them,” she said, noting that her grandmother was born in Czechoslovakia, and her mother in Hungary and she in the Soviet Union. “None of us moved anywhere.”