Kostajnica was no longer safe from recapture. In 1596, a well-organized attempt by generals Sigismund Herberstein and Juraj Lenković with 6,000 troops ended in failure. The attackers encountered heavily fortified defensive positions and – having no artillery and receiving news about incoming Ottoman reinforcements – decided to withdraw. Raids in 1624 and 1651 were again successful in dispersing the Ottoman troops, but failed to capture the fortress. Kostajnica was finally taken in 1688, by the army of Louis William, Margrave of Baden-Baden joined with the troops led by ban Nikola Erdödy. The attacking force, equipped with 15 cannons, was able to reach strategic positions around the Ottoman fortress without encountering significant resistance. On the third day of the operation, they seized the fortress after an artillery attack. 18th century to present During the early 18th century two schools are opened in the city. One school was operated by Catholic Missionary Church of “St. Antun Padovinski”, while the second schools was run as a Serbian Public School. Kostajnica is known for its natural springs such as; Varoški Bunar, Mrzlenac, Tekija, Pekinac, Paunovac, Angelovac, and Tutulovac. The most popular spring Tekija has engraved sign (drink brother, potion was given to you by the god's mercy) “Pi brate iz Božje milosti dat ti je napitak.” In the late 19th and early 20th century, Kostajnica was a district capital in the Zagreb County of the Kingdom of Croatia-Slavonia. During World War II, the town was occupied by Axis troops and was included into the Pavelić's Independent State of Croatia (NDH). The fascist Ustashe regime committed the Genocide of the Serbs and the Holocaust. Between 29 and 37 July 1941, 280 Serbs were killed and thrown into pits near Kostajnica. The town was bombed by American forces on May 30, 1944. Kostajnica suffered greatly during the Croatian War of Independence. A large part of the Croatian population were expelled or killed by rebel Serbs in 1991 and the city was incorporated into the Republic of Serbian Krajina. Houses and buildings belonging to Croats were burned and looted, including the baroque church, the medieval apothecary, and the eighteenth-century Franciscan monastery. The only piece of the city's cultural heritage left was the castle by the river built by the Frankopans. Kostajnica was put back in Croatian control following military victories by the army in August 1995, and the Croat population expelled slowly began returning. Population The municipality