The gunman was also killed during the attack yesterday in the town of Zvornik, police spokeswoman Aleksandra Simojlovic told The Associated Press. "Allahu Akbar" is the Arabic phrase for "God is great."
The Bosnian Serb police chief, Dragan Lukac, identified the man as Nerdin Ibric.
Zvornik is a town in the Bosnian Serb part of the country and it is located on the border with Serbia. Before the 1992-95 war, about 60 per cent of the town's population was Muslim Bosnians. Almost all were expelled and many were killed during the war as part of a Serb campaign to create a purely Serb area.
The two have their own governments, but are linked by a central government based in Sarajevo.
After the war, only a few thousand Muslims returned to the Serb area of Zvornik.
Security Minister Dragan Mektic said the gunman stormed into the building with an automatic rifle and was killed in crossfire with police inside. He said Bosnia's intelligence service had vague information about a potential terrorist attack three days ago, but that they didn't know when or where it might occur.