but this plan failed because of its weak execution by the main commander of the military operations: general Ernő Kiss. In the end of December 1848 he worked in the general staff section of the Hungarian Ministry of Defence. When in December 1848 the main Austrian imperial troops led by Field Marshal Alfred I, Prince of Windisch-Grätz attacked Hungary, he was appointed as Major in the Hungarian army, by 9 January 1849 he was already a Colonel. Together with his chief Antal Vetter he elaborated the plan of retreating the main Hungarian troops behind the Tisza river, and became commander of the Upper Tisza Corps (Felső-tiszai hadtest). Before this the Upper Tisza Corps was led by the Minister of War General Lázár Mészáros, who was defeated by the Austrian troops led by Lieutenant-General Franz Schlik in the Battle of Kassa. Klapka took over these beaten troops in January 1849, reorganized them, and beat Schlik in three consecutive battles at Tarcal (20 January), Bodrogkeresztúr (23 January), and Tokaj (31 January). Thanks to these victories Klapka held the Hungarian defensive line along the Tisza river, and won precious time for the Hungarian commandment to organize the counter-attack against Windisch-Grätz imperial troops. From 29 January 1849 he was under the command of Lieutenant-General Henryk Dembiński the main commander of the Hungarian armies. After their victory at 5 February 1849 in the Battle of Branyiszkó, the Upper Danube Corps led by Artúr Görgei approached to the Tisza river from North-West, menacing, together with Klapka's corps, to encircle and destroy Schlik's army. Understanding the importance of this chance, Klapka tried to convince Dembiński, to attack from the South Schlik's corps, but the latter refused, ordering Klapka to retreat. This wrong decision of the main commander enabled Schlik to escape the danger, and to retreat. Klapka defeated him again on 8 February at Hidasnémeti, but the Austrian general was able to retreat towards West, joining the main imperial troops led by Windisch-Grätz. Klapka participated during 26–27 February in the Battle of Kápolna, commanding the right wing of the Hungarian army at Verpelét. The battle was lost because of Dembiński's poor army leading and indecision. After Dembiński's order of retreat, at 1 March Klapka fought successful rearguard actions against the Austrian corps led by Ladislaus von Wrbna at Egerfarmos. At 3 March he was one of the leaders of the revolt at Tiszafüred of the Hungarian officers