It was created by Emperor Frederick Barbarossa in 1180 when he raised the March of Styria to a duchy of equal rank with neighbouring Carinthia and Bavaria, after the fall of the Bavarian duke Henry the Lion earlier that year. Margrave Ottokar IV thereby became the first Duke of Styria and also the last of the ancient Otakar dynasty. As Ottokar had no issue, he in 1186 signed the Georgenberg Pact with the mighty House of Babenberg, rulers of Austria since 976, after which both duchies should in perpetuity be ruled in personal union. Upon his death in 1192, Styria as stipulated fell to the Babenberg duke Leopold V of Austria.
The Austrian Babenbergs became extinct in 1246, when Duke Frederick II the Quarrelsome was killed in battle against King Béla IV of Hungary. Styria, actually a ceased Imperial fief, became a matter of dispute among the neighbouring estates. It passed quickly through the hands of Hungary in 1254, until the Bohemian king Ottokar II Přemysl conquered it, being victorious at the 1260 Battle of Kressenbrunn. As King Ottokar II had married the last duke's sister Margaret of Babenberg he laid claim to both Austria and Styria, which however met with strong opposition by the elected German king Rudolph of Habsburg, who now recalled the duchies as reverted fiefs. Rudolph finally defeated Ottokar at the 1278 Battle on the Marchfeld, seized Austria and Styria and granted them to his sons Albert I and Rudolf II.
The House of Habsburg provided Styria with dukes of their lineage ever since. It however was separated from Austria by the 1379 Treaty of Neuberg, after which Styria, Carinthia and Carniola formed the Inner Austrian territory ruled by the descendants of Leopold III of Habsburg of the Leopoldian line, who took their residence at Graz. In 1456 they could significantly enlarge the Styrian territory by acquisition and re-acquisition of the comital Celje estates in Lower Styria. Both duchies were again ruled in personal union, when Leopold's grandson Frederick V inherited Austria in 1457. In 1496 Frederick's son Maximilian I signed an order expelling all Jews from Styria, who were not allowed to return to Graz until 1856. In 1512 the duchy joined the Empire's Austrian Circle.
A second Inner Austrian cadet branch of the Habsburgs ruled over Styria from 1564. Under Archduke Charles II of Inner Austria, Graz became a centre of the Counter-Reformation, expedited by the Jesuits at the University of Graz established in 1585 and continued under Charles' son Archduke Ferdinand II, who became sole rule of all Habsburg hereditary lands and Holy Roman Emperor in 1619. The Protestant population was expelled, including the astronomer Johannes Kepler in 1600. Meanwhile, at the time of the Ottoman invasions in the 16th and 17th centuries after the 1526 Battle of Mohács, the land suffered severely and was depopulated. The Turks made incursions into Styria nearly twenty times; churches, monasteries, cities, and villages were destroyed and plundered, while the population was either killed or carried away into slavery.
Duchy of Styria in modern Austria and Slovenia
Styria remained a part of the Habsburg Monarchy and from 1804 belonged to the Austrian Empire. The development of the duchy was decisively promoted by Archduke John of Austria, younger brother of Emperor Francis I, who in 1811 founded the Joanneum, predecessor of the Graz University of Technology, and the University of Leoben in 1840. He also forwarded the construction of the Semmering railway to Mürzzuschlag and the Austrian Southern Railway line from Vienna to Trieste completed in 1857, which boosted the Styrian economy. In the course of the Austro-Hungarian Compromise of 1867 (Ausgleich), the duchy was assigned as a crown land for the Cisleithanian part of the Austro-Hungarian Monarchy, while along with the rise of nationalism the conflict between the German and Slovene population intensified.
On the collapse of Austria-Hungary in the aftermath of World War I, the rump state of German Austria claimed all Cisleithanian Austria with a significant German-speaking population including large parts of the Styrian duchy, while the Slovene Lower Styrian part joined the State of Slovenes, Croats and Serbs. Armed conflicts arose especially around the multilingual town of Maribor (Marburg), until by the 1919 Treaty of St Germain the former duchy was partitioned broadly along ethnic lines, with two thirds of its territory (then called Upper Styria) including the ducal capital of Graz remaining with Austria, and the southern third of Lower Styria with Maribor passing to the Kingdom of Serbs, Croats and Slovenes, eventually becoming part of modern Slovenia.