Denmark, which had conquered northern Estonia in the 13th century, established a wooden border stronghold here in the mid-13th century. It is first mentioned in writing in 1256, the date the infobox gives as the build date. The first entirely stone fortifications came in the early 14th century, a small castellum-like building with sides about 130 feet (40 m) tall and a tower at the northwestern corner.
King Valdemar IV of Denmark sold the castle in 1346 to the Livonian Order, which rebuilt it as a convent building. After 1492 the Order completed the Hermann Tower, prompted by the Ivangorod fortress that Muscovite Russia had built across the river. The ground plan, with massive wings around a central courtyard, is largely preserved.
In the late 16th century the town wall was reinforced and several towers became cannon rondels.

Comments