The settlement has existed since
Roman times. It was conquered by the
Ottoman Empire somewhere between 1520 and 1530. From 1929 to 1941, Bosanski Petrovac was part of the
Vrbas Banovina of the
Kingdom of Yugoslavia. When the German and Italian
Zones of Influence were revised on 24 June 1942, Bosanski Petrovac fell in , administered civilly by Croatia and militarily by Croatia and Germany. During the Second World War, it was a Partisan stronghold which was conveniently located close to Marshal
Josip Broz Tito's headquarters in Drvar. On 6 December 1942 the
Women's Antifascist Front of Yugoslavia (AFŽ) was established in the town.
Judita Alargić was a key figure in the first generation of AFŽ organisers. During the 1992–95
Bosnian War, the town's
Serb majority remained in the city while the
Bosniaks and
Croats were forced to leave their homes. Then in 1995, as the war was nearing its end, the
Army of the Republic of Bosnia and Herzegovina seized Bosanski Petrovac and it remained in Bosnian hands until the end of the war. In the following years, the Serbs' right to return would be hindered. However, the town would eventually return to its pre-war ethnic composition. ==Settlements==