The fortress NehajĀ served as a military fortification that used it as a place to defend the city of Senj .