More than a century later, Count Dom Henrique (to whom the Portuguese county had been granted) chose Guimarães to establish his court: maybe he took this decision due to the safety conditions given by the Castle of St. Mamede (name given by its founder). The Fortress, more than 100 years old, needed urgent reforms and the nobleman chose to throw down what remained from Mumadona's construction, extending the area of the 10th century Fortress with new and powerful walls. He still had two entrances opened: the main one on the west side, to watch the borough, and the east one, called the Traição (Betrayal) door.
During the reign of King Dinis a new rebuilding was required due to the fights he had with his son, the future King Afonso IV. The last works were done during the reign of King John I, who ordered the building of the towers that flank the two entrances.