The fortress was completed in 1540 to protect the town against the Ottoman threat.
The wall was built to protect the Ottoman's from being conquered. 
mnli hypothesis: The wall was built to protect the Ottoman's from being conquered.  premise: The fortress was completed in 1540 to protect the town against the Ottoman threat.