BUDAPEST -- Daniel Szabo and Gergo Birtalan are both optimistic about their job prospects in their native Hungary, which has a low unemployment rate for college and university graduates. But the two Hungarian students are in totally different situations.
When Mr. Szabo, 24, graduates soon from law school, he will be free to go wherever in the world he wants. But Mr. Birtalan, 18, was required to sign a contract at the beginning of his first year as a sociology major because of a new rule introduced in September. As a beneficiary of the state-funded university system, he will be obliged to work for two years in Hungary for every year of his subsidized studies.
Such contracts, the only ones of their kind in Europe, have met with broad opposition and street protests from both high school and university students.
If Mr. Birtalan finishes a typical three-year degree, his movements will be restricted for six years after graduation, when he will be in his late 20s, or even older if he pursues post-graduate studies domestically. The rule applies to all students at state universities, as well as those at state-funded places in private institutions.
If Mr. Birtalan finds a good overseas opportunity before his allotted time, he will have to pay back his tuition. A three-year undergraduate degree would cost him about 900,000 Hungarian forint, or about $4,100. A two-year master's degree in communications would be another 900,000 forint.
While those sums pale in comparison with tuition at state-funded schools in the United States or Britain, they are considered significant in Hungary, where the average monthly salary, after taxes, is 140,000 forint, and where citizens are accustomed to subsidized education.
Officials said it was not an unreasonable amount for Hungarian students who studied free under the state and then found lucrative work in Western Europe.
"It's not impossible," Ferenc Kumin, a representative of the prime minister's office, said of repayment. "A salary in Norway or in Great Britain could finance the payback of this tuition fee."
Still, students were not convinced.
"I signed it, but I felt really bad and angry about it," Mr. Birtalan, the sociology student, said in a small Budapest cafe near the Danube River, which serves as the unofficial headquarters for HaHa, a student movement that has demanded the removal of the contracts.
In December, several months after the contracts were initiated, about 2,000 students held a demonstration against the new rules, according to local news reports.
After the demonstrations, the Ministry of Human Resources began a series of roundtable talks with teachers, student groups and Chamber of Commerce representatives in late January.
HaHa was not invited, and Mr. Szabo said that if their demands were not met, they would protest with civil disobedience. According to local news reports, about 30 to 40 students occupied the faculty of humanities at Eotvos Lorand University in Budapest last Monday. The faculty was occupied at least until Friday, and HaHa leaders said they had more protests planned.
The Hungarian government sees the contracts as necessary means to combat "brain drain," said Zoltan Balog, the government minister in charge of human resources, referring to graduates' choosing to work abroad.
"How can it be that we are training several hundreds of doctors every year -- which costs the taxpayers a whole lot of money -- who after graduation immediately go to Norway, to Sweden, to England?" Mr. Balog said in an interview.
"I don't want to enslave them," he said of Hungarian students. "I want to have a balance between the individual interest and the national interest. This country is investing in higher education, so whoever graduates should also use their knowledge to further the interest of the country."
According to the government, more than 73 percent of full-time university students in Hungary attend institutions where the tuition is funded by the government. Mr. Kumin said this was a big change since the end of Communist rule in Hungary in 1989, when "it was a kind of privilege to get into the university."
Today, students have "a kind of strategy to stay as long as they can in university," he continued. "These are free programs. You can stay as long as you want, and it costs a lot of money for the taxpayers and the budget. This tendency had to be stopped."
Agnes Urban, an assistant professor at the faculty of business administration at Corvinus University of Budapest, said she thought the government's tough stance toward students was driven by the possibility of electoral gains.
"It is really populist, and it is really working. It is a potential winning strategy among the voters," she said.
Jozsef Temesi, director of the Corvinus Center for International Higher Education Studies, said the government was portraying the protesting students "as unreliable, lazy persons who just demand from the society and do not want to perform."
At one point, the government considered withdrawing state funding from some fields of study -- like the humanities and international relations -- that were not seen as being as market-friendly. But after student demonstrations in December and negotiations in January, the government withdrew the plan.
Dr. Temesi said the government lacked a comprehensive strategy on higher education. "My view is that there are too many ad hoc measures," he said.
He also said that there had been little evidence that administrative or tax-related measures worked to stop brain drain. "There is a need for positive actions, like generating jobs, increasing salary levels," he said.
While the law requiring the contracts was passed by the Hungarian Parliament, and is already in force, there is the question of whether the European Union -- which Hungary joined in 2004 -- would allow it, since the freedom of movement of labor is guaranteed in the European Union.
Mr. Balog, the government minister, said the contract was compatible with E.U. law.
"I think it could be possible to establish a legal formula that complies with the idea of free movement of labor and with the interest of the state," he said. "It's actually not obligatory to study free of charge at the university."
In an e-mailed response, Dennis Abbott, a European Commission representative, said only that talks were continuing with the Hungarian authorities on the issue.
The first students who signed the contract are not expected to graduate until 2015. Depending on the outcome of Hungary's parliamentary election next year -- or various other factors like continued protests or an E.U. decision -- the contracts might be annulled before then.
If the opposition Hungarian Socialist Party manages to win power over Fidesz, the governing conservative party, it will abolish the contract system, the opposition leader, Attila Mesterhazy, said in an interview.
The Hungarian Socialist Party, which ruled in a coalition government from 2002 to 2010, had tried to introduce tuition fees to reduce the budget deficit. But in a 2008 referendum, voters decided they wanted free higher education to return.
This article originally appeared in The New York Times.