Built on Roman foundations , the castle was erected in the late 13th century to keep the Scots at bay its strategic position affords good views of the surrounding lowland .
The castle 's strategic position was decided upon by the king and his advisors .