sentence1: The fortress was completed in 1540 to protect the town against the Ottoman threat.
sentence2: The Ottomans were on a mission of conquest and the fort was built around 1540 to protect them from the Ottomans conquering them.