When the Croats under Josip Jelačić attempted to have Međimurje, which was then part of Hungary, returned to Croatia, Andrássy entered military service. He was commander of the gentry of his county, and served with distinction at the battles of Pákozd and Schwechat, as Artúr Görgei's adjutant (1848).