Although the knights suffered a crippling defeat in the Battle of Grunwald (Tannenberg), Königsberg remained under the control of the Teutonic Knights throughout the Polish-Lithuanian-Teutonic War. Livonian knights replaced the Prussian branch's garrison at Königsberg, allowing them to participate in the recovery of towns occupied by Władysław II Jagiełło's troops.