In 803, the Frankish emperor Charlemagne swept through the Danube Valley, establishing a new territory called Ostmark (the Eastern March). When Charlemagne died in 814 and his once-mighty empire disintegrated, Vindobona struggled to survive. The earliest known reference to the site by the name we know today (Wenia) appeared in a proclamation of the archbishop of Salzburg in 881.
In 976, Leopold von Babenberg established control over Austria, the beginning of a 3-century rule. Commerce thrived under the Babenbergs, and Vienna grew into one of the largest towns north of the Alps. By the end of the 10th century, Ostmark had become Ostarrichi, which later changed to Österreich (Austria).
Toward the end of the 12th century, Vienna underwent an expansion that would shape its development for centuries to come. In 1200, Vienna's ring of city walls was completed, financed by the ransom paid by the English to retrieve their king, Richard Coeur de Lion (the Lion-Hearted), who had been seized on Austrian soil in 1192. A city charter was granted to Vienna in 1221, complete with trading privileges that encouraged the town's further economic development.
In 1246, when the last of the Babenbergs, Friedrich II, died without an heir, the door was left open for a struggle between the Bohemian, Hungarian, and German princes over control of Austria. The Bohemian king Ottokar II stepped into the vacuum. However, Ottokar, who controlled an empire that extended from the Adriatic Sea to Slovakia, refused to swear an oath of fealty to the newly elected emperor, Rudolf I of Habsburg, and the opposing armies joined in one of Vienna's pivotal conflicts, the Battle of Marchfeld, in 1278. Though Ottokar's administration was short, he is credited with the construction of the earliest version of Vienna's Hofburg.