Complex sentence: It is uncertain when the keep was built, although it probably dates to the 12th century when it was the residence for the lord of the castle--the owner or his representative.
Split into simpler sentences: It is uncertain when the keep was built, although it probably dates to the 12th century. The keep acted as the residence for the lord of the castle--the owner or his representative.