The castle suffered major devastation during an attack by the Teutonic Knights in 1377. After the assassination of Kęstutis, a power struggle between Jogaila and Vytautas the Great for the title of Grand Duke of Lithuania began. The castle was besieged by both sides. Soon after the reconciliation between Jogaila and Vytautas, the second phase of construction started and continued until 1409. This phase is regarded as the major development in the history of the castle. Apparently, during the truce with the Teutonic Order, the construction works were supervised by the Order's stonemason Radike, four years before the Battle of Grunwald.