She had buried child after child. When one finally lived, they said he had been smuggled into her bed in a warming pan.

Mary Beatrice d'Este was fifteen when she left Modena for England. She had grown up in a Catholic court and had once seemed destined for a religious life. Instead, she was being sent across Europe to marry James, Duke of York, the forty-year-old brother of Charles II. He was already a widower, already a father, and more than twice her age.

She had been born at Modena on 5 October 1658, the eldest child and only daughter of Alfonso IV, Duke of Modena, and Laura Martinozzi. Fifteen years later she began the journey that would carry her into a country where her Catholicism would immediately make her politically suspect. James was openly Catholic, England was increasingly fearful of Catholic influence, and the arrival of a young Italian Catholic bride at his side carried meaning far beyond the household they would share.

Mary and James were married in person in November 1673. She was still only fifteen. Fourteen months later, in January 1675, she gave birth to a daughter, Catherine Laura. Mary had the baby baptised according to the Catholic faith. Charles II intervened and had the child taken to the Chapel Royal, where she was christened again according to the rites of the Church of England.

Catherine Laura did not live to see her first birthday. More pregnancies followed, and so did more loss. She became pregnant repeatedly, and repeatedly the children did not survive.

One daughter, Isabella, seemed for a time to have escaped that pattern. Born in 1676, she survived infancy and lived long enough for Mary to know her as a small child rather than simply as another fragile royal baby. Isabella died in 1681, only four years old. Another daughter, Charlotte Maria, was born the following year and also died young.

Charles II had no legitimate children with his queen, Catherine of Braganza. That meant the succession would pass to his younger brother James, and because James was openly Catholic, the question of what happened after Charles's death had already become deeply political. If James inherited the throne and then produced a surviving Catholic son, England could face not simply a Catholic king, but the beginning of a Catholic royal line.

James had two surviving daughters from his first marriage, Mary and Anne, both raised as Protestants. As long as he and Mary of Modena had no surviving son, many of his opponents could look beyond a Catholic duke, and later a Catholic king, toward a Protestant succession. The sex, survival and religion of any child she bore mattered to the future government of the kingdom.

When Charles II died in 1685, James became king and Mary became queen. Her position grew grander, but the pressure surrounding her pregnancies became greater rather than less. James was now openly Catholic on the throne of a predominantly Protestant country, and his adult daughters remained the expected heirs if he produced no surviving son. For those who feared the establishment of a lasting Catholic dynasty, Mary's childlessness had become politically reassuring.

Then she became pregnant again.

By the winter of 1687 and 1688, the pregnancy was being watched with extraordinary attention. If Mary gave birth to a daughter, the existing succession would remain largely unchanged. If the child died, the same would be true. But if she produced a healthy son, he would stand ahead of James's Protestant daughters and become heir to the throne.

On 10 June 1688, Mary went into labour at St James's Palace. Royal childbirth was never entirely private, because the legitimacy of an heir had to be witnessed, but this birth attracted exceptional scrutiny. Courtiers, officials and noblewomen were present in and around the chamber. The political importance of the child had drawn the court close to the queen's bed.

Mary gave birth to a boy, James Francis Edward. For the first time, the child at the centre of all that expectation survived.

After so many pregnancies and so many losses, Mary had finally given James the living male heir their marriage had always been expected to produce. Yet almost as soon as the child was born, another story began to spread. Mary's enemies claimed that she had not given birth at all. According to the rumour, another woman's baby had been smuggled into the queen's bedchamber inside a warming pan and passed off as the newborn prince.

Forty-two of the people who had been present at the birth later gave testimony that the child was hers. If the baby was genuine, England now had a Catholic male heir. If he could be dismissed as an impostor, the Protestant succession through James's daughters could still be defended.

No one had needed elaborate theories to explain the children who died. Their bodies had been accepted as hers without question. It was only when a son lived that opponents decided the child could not belong to her.

The rumour became part of a much larger crisis. William of Orange landed in England in November 1688, and support for James II began to collapse with remarkable speed. Officers deserted him, political allies abandoned him, and the regime that had looked secure only months earlier began to disintegrate. The birth of the prince had not caused the crisis by itself, but it had changed its urgency. A Catholic king who might soon be followed by a Protestant daughter was one thing. A Catholic king with a Catholic son and heir was another.

In December, Mary prepared to leave England. Her son was only six months old.

On the night of 9 December 1688 the Queen of England put on a laundress's clothes. She left Whitehall in the dark and the rain with her six-month-old son and two nurses, and a small boat took them across a rough Thames to Lambeth. On the far bank there was no coach. She stood with the baby under the walls of the old church, in the storm, and waited. At last a coach and six came out of the inn by the landing place. It took them to Gravesend, and a yacht took them on to France.

Louis XIV offered refuge to the displaced Stuart family. The young Italian princess who had once travelled west to England because kings and ministers wanted her to produce heirs was now travelling east again with the one child who had survived.

Fifteen years had passed since Mary had left Modena. In that time she had become a duchess, a mother, a queen and then an exile. She had spent years becoming pregnant and watching children die. At last she had given birth to the son her marriage had always been expected to produce. Her enemies answered by saying he was not hers. Six months later, Mary carried him out of England.