Šabac (Шабац, ʃâbat͡s) is a city and the administrative centre of the Mačva District in western Serbia. The traditional centre of the fertile Mačva region, Šabac is located on the right banks of the river Sava. , the city proper has population of 51,163, while its administrative area comprises 105,432 inhabitants.
The name Šabac was first mentioned in Ragusan documents dating to 1454. The origin of the city's name is uncertain; it is possible its name comes from the name of the city's main river, the Sava. The city is known by a variety of different names: Zaslon in medieval Serbian, Szabács in Hungarian, Böğürdelen in Turkish, and Schabatz in German.
Archaeological evidence attests to more permanent settlement in the area from the Neolithic. In the Middle Ages, a Slavic settlement named Zaslon existed at the current location of Šabac. The settlement was part of the Serbian Despotate until it fell to the Ottoman Empire in 1459.
In 1470, the Ottomans built the first fortress in the town and named it Beyerdelen (Böğürdelen, meaning "side-striker"). In 1476 the Hungarian king Matthias Corvinus captured the fort; it remained under administration of the Kingdom of Hungary until 1521, when it was again captured by the Ottomans. Under Hungarian administration, the town was part of the Banate of Macsó, whereas under Ottoman administration it was firstly part of the Sanjak of Zvornik within the Province of Bosnia, and later part of the Sanjak of Smederevo. Šabac was the administrative centre of the nahiye of Šabac, a local Ottoman administrative unit. During the Ottoman period, Šabac was a typical oriental town with tiny streets, small shops and several mosques. The population was composed of both Muslims and Serbs, along with smaller numbers of Hungarians and Croats.
Until the 19th century, Šabac was mostly under Ottoman administration, but control of the town changed hands several times between the Ottoman Empire and the Habsburg monarchy during the Ottoman-Habsburg wars.