Then, last year, the Republika Srpska abruptly rewrote the rules governing milk subsidies, slashing Mr. Arifagic's revenue but leaving intact the money received by smaller Serb-owned dairy farms. "If your name is Jusuf," he said, referring to his name, which immediately identifies him as Muslim, "nothing is ever easy here."
Mr. Djakovic, the Serb mayor of Prijedor, said that he had opposed the subsidy change and that he believed Mr. Arifagic's travails stemmed from his frequent clashes with the dominant Serb party, led by the nationalist Milorad Dodik, rather than from his ethnicity.
"You can either struggle uphill or go downhill with ease," Mr. Djakovic said. "If you criticize politicians, then you will have problems."
Hoping to fare better outside the Republika Srpska, Mr. Arifagic set up a satellite farm with 400 cows in the territory of the entity led by Muslims and Croats.
But there, too, he ran into problems after refusing to support the dominant Muslim party, led by the son of the wartime leader Alija Izetbegovic. Instead, he joined a rival party that he felt was less focused on stoking ethnic grievances. A mysterious fire later burned down part of his property.
Mr. Arifagic said he planned to keep feeding his cows until his supplies ran out and then shut down the business, though he said he would remain in Bosnia for the time being: "I want to finish and close everything. After that, Dodik and Izetbegovic can milk cows themselves."