Although the exact age of Narva Castle and the town still cause arguments between historians, they agree on the sequence of events. Firstly, in about the 13th century, the Danes, who had conquered Northern Estonia built a wooden border stronghold at the crossing of the Narva River and the old road. Under the protection of the stronghold, the earlier settlement developed into the town of Narva, which obtained the Lübeck town rights in the first half of the 14th century. Following several conflicts with the Russians, the Danes started building a stone stronghold at the beginning of the 14th century. It was a small castellum-like building with sides and a tower, a predecessor of the today's Herman Tower, at its north-western corner. At the beginning of the 14th century, a small forecourt was established at the north side of the stronghold and, in the middle of the century, a large forecourt was added to the west side, where citizens were allowed to hide in case of wars as the town of Narva was not surrounded by a wall during Danish rule. In 1347 King Valdemar IV of Denmark sold Northern Estonia, including Narva, to the Livonian Order, who rebuilt the building into a convent building according to their needs. The stronghold has for the most part preserved the original ground plan, with its massive wings and a courtyard in the middle. The Herman Tower was also completed at the time of the Order, necessitated by the establishment of Ivangorod Castle by the Russians on the opposite side of the Narva River in 1492. The Order surrounded the town with a wall, which unfortunately has not been preserved. The wall is described as having had four gates: the Viru Gate in the west, the Herd Gate in the north, the Old Gate leading to the river port in the east and the Water or Small Gate in the south. The gates were covered with iron plates and preceded by drawbridges. The town wall, with a length of about a kilometre, was fortified with at least seven towers. The town wall was surrounded by a moat. Towards the end of the Order's period, the town wall was supplemented, the gates were strengthened by adding foregates, and several medieval wall towers were adapted to use as special cannon towers or rondels, two of which can be seen today in their reconstructed shape in the corners of the castle's western court. opposite Hermann Castle, with Narva River in between