Asylum claims filed by the five Afghans and one Iranian man had been rejected and they were awaiting deportation.
Police initially spoke of a collective suicide attempt but later downplayed that premise.
"We think the men wanted to highlight their unhappiness," police spokesman Harald Soros told AFP.
The men had composed a letter which said they had no prospects for the future and mentioned dates two had been given for deportation.
One of the men had previously staged a hunger strike, and Soros said the fire might have been an attempt to prevent the deportation process.
Police said the migrants huddled in the cell's bathroom after starting the fire and put a rag against the door to keep smoke from entering.That did not seal the bathroom off however, and one of the men then dashed to the cell door to raise the alarm.
All six were treated in hospital for smoke inhalation and one also suffered burns, but police said their lives were not in danger.