Margravial Austria reached its greatest height under Leopold III, a great friend of the church and founder of abbeys. He patronised towns and developed a great level of territorial independence. In 1139, Leopold IV inherited Bavaria. When his successor, the last margrave, Henry Jasomirgott, was deprived of Bavaria in 1156, Austria was elevated to a duchy independent from Bavaria by the of Emperor Frederick Barbarossa. From 1192 the House of Babenberg also ruled over the neighbouring Duchy of Styria. The line became extinct with the death of Duke Frederick II of Austria at the 1246 Battle of the Leitha River. The heritage was finally asserted by the German king Rudolph of Habsburg against King Ottokar II of Bohemia in the 1278 Battle on the Marchfeld.