Bulgarian police fired water cannon and rubber bullets to quell a riot by migrants angered at being confined to their refugee camp due to a health scare, the interior ministry said.
The unrest at the camp in Harmanlı, a town close to the Turkish border, came two days after authorities sealed it off to prevent anyone leaving after local media reported that the migrants were carrying infectious diseases.
Earlier on Thursday, residents set fire to furniture and tyres and threw stones at riot police, who deployed water cannon. In the evening, police pushed back a large group trying to leave the camp, home to 3,000 people, mostly thought to be Afghans.
"We used a water cannon, blanks and rubber bullets as well as physical force," Interior Ministry Chief Secretary Georgi Kostov told reporters outside what is Bulgaria's biggest refugee camp.
"Over 40 of the most rampaging migrants were detained, they will be charged," he said adding the four police officers had been wounded. He said was not aware of any wounded migrants.
Reflecting the gravity of the situation - and the political impact of the migrant crisis - Prime Minister Boiko Borisov was on his way to the camp late on Thursday, a spokeswoman said.
Last week Harmanlı townspeople staged a protest calling for the camp's closure after media alleged that migrants there carried communicable skin diseases.
The head of the Bulgarian Refugee Agency, which runs the camp and took the decision to seal it temporarily to allow health authorities to investigate, told Bulgarian National Radio that those reports were false.
Bulgaria has built a fence on its border with Turkey and has bolstered its border controls to prevent inflows of illegal migrants. Some 17,000 migrants were detained in the first 10 months of the year, down by more than a third on last year.
Despite the decreasing numbers, Bulgarian nationalists have staged protests in recent months calling for the immediate closure of all refugee centres, and for migrants to be returned to Turkey or their countries of origin.
They say Bulgaria, the EU's poorest member state, cannot afford to support them in such numbers.