Maria Theresa was twenty-three and pregnant. She had already buried her eldest child. Her father had spent years securing her inheritance. He had done much less to prepare her to rule it.

On 20 October 1740, Emperor Charles VI died in Vienna, and his daughter Maria Theresa succeeded to the hereditary Habsburg lands. She became Archduchess of Austria and succeeded to the crowns of Hungary and Bohemia in her own right. The imperial crown was another matter. That office was elective, and her father's death did not make her Holy Roman Empress.

At home there were two little girls. Maria Anna had just turned two. Maria Karolina was nine months old. Their elder sister, Maria Elisabeth, had died in June, aged three. Maria Theresa was carrying the fourth child of her marriage to Francis Stephen of Lorraine.

Charles had tried to provide for that future. In 1713, four years before Maria Theresa was born, he had issued the Pragmatic Sanction, a succession settlement intended to keep the Habsburg territories together and allow a daughter to inherit if there were no male heir. He spent years negotiating its recognition abroad. There were treaties, undertakings and diplomatic concessions. Prussia had signed up in 1728. His daughter's right to succeed had received a great deal of attention.

Her preparation for government had received considerably less. Her parents went on hoping for a son, and she was educated as a princess: music, dancing, languages, religion and the deportment expected at court. She learned French, Italian, Spanish and Latin, but neither Hungarian nor Czech, the languages of lands she would govern. Nobody taught her political theory, military science or diplomacy. She could take her place at court. The business conducted behind it had largely been kept from her.

Now the men who had served her father had to advise his daughter, and she had to govern through them. Experienced ministers had their own loyalties and rivalries, and she needed their knowledge before she could challenge their authority. Years later she described her position plainly. She had been "without money, without credit, without army, without experience and knowledge of my own." She had resolved, she wrote, "not to conceal my ignorance, but to listen to each in his own department."

She had the right. She did not yet have the means.

The first great test came before the year was out. On 16 December, Frederick II of Prussia invaded Silesia. Less than two months had passed since Charles's death, and Prussia was one of the states that had promised to honour the settlement. Frederick had an army ready to move and the finances to support it, advantages that were rather more useful than the promises accumulated by her father. Maria Theresa rejected his proposed compromise over the province. The struggle to keep her inheritance had become a war.

She went through that first winter of the war pregnant. In January 1741, Maria Karolina died, shortly after her first birthday. On 13 March, Maria Theresa gave birth to a son, Joseph. After three daughters, the dynasty had its long-awaited boy. His arrival strengthened its prospects for another generation. It did not remove the Prussian soldiers from Silesia. Long afterwards she wrote that she would have gone to the army herself, "had I not been nearly always enceinte."

By June, she was preparing to be crowned in Hungary. The ceremony required the sovereign to ride up a hill and point a sword towards the four directions, a promise to defend the kingdom against its enemies. Officials discussed carrying her up in a sedan chair. She practised riding instead.

On 25 June, at Pressburg, she received the Hungarian crown. It was placed on her head, as it was for a reigning king, rather than touched to her shoulder as at a queen consort's coronation. She rode up the coronation hill with the sword of St Stephen and performed the ritual. The Hungarian estates made a point of the difference. They had crowned her as their king.

The fighting continued. Prague fell to her enemies, and was recovered. Her husband became Holy Roman Emperor in 1745, giving her the title of empress as his consort, five years after she had begun ruling her own lands. When peace came in 1748, her position was internationally recognised, but most of Silesia remained Prussian. She had preserved the monarchy at a cost she could not undo.

What followed addressed the weaknesses exposed at her accession. From 1749, working with Friedrich Wilhelm von Haugwitz, she reorganised administration in the Austrian and Bohemian lands, bringing their government and finances under a central authority. Hungary kept its separate administration. The work was less splendid than a coronation: officials, accounts, tax arrangements, the means of paying for an army. They were the means she had not had in 1740, when the treaties were put to the test.

She also set down what she had inherited and what she had changed. In her political testament of 1749–50, she described the ministers' disputes, her own early inexperience and the struggle to make the machinery of government answer to the sovereign. She was writing for her successors, including the son she had been carrying when her father died.

At twenty-three she had received lands, titles and promises, with two surviving daughters and another child on the way. When she explained why she had rebuilt the government, she returned to the children who would inherit after her. She had done it, she wrote, "so that my children should not fall into the same labyrinth as I."