In 1682 he joined the Imperial Army and fought against the Turks in the Battle of Vienna and the Siege of Buda (1684).