Tudor era, as did the English Reformation in religion, impacting the future of the Crown. When Elizabeth I died childless, the Scottish House of Stuart succeeded as England's royal family through the Union of the Crowns of 24 March 1603. The first Stuart to become King of England (), James VI and I, descended from Henry VII's daughter Margaret Tudor, who in 1503 had married King James IV of Scotland in accordance with the 1502 Treaty of Perpetual Peace. Ascent to the throne The Tudors descended from King Edward III on Henry VII's mother's side from John Beaufort, 1st Earl of Somerset, one of the children of the 14th century English prince John of Gaunt, the third surviving son of Edward III. Beaufort's mother was Gaunt's long-term mistress Katherine Swynford. The descendants of an illegitimate child of English royalty would normally have no claim on the throne, although Gaunt and Swynford eventually married in 1396, when John Beaufort was 25. The church then retroactively declared the Beauforts legitimate by way of a papal bull the same year, confirmed by an Act of Parliament in 1397. A subsequent proclamation by John of Gaunt's son by his earlier wife Blanche of Lancaster, King Henry IV, also recognised the Beauforts' legitimacy but declared the line ineligible for the throne. Nevertheless, the Beauforts remained closely allied with Gaunt's descendants from his first marriage, the House of Lancaster, during the civil wars known as the Wars of the Roses. However the descent from the Beauforts, did not necessarily render Henry Tudor (Henry VII) heir to the throne, nor did the fact that his father's mother, Catherine of Valois, had been a Queen of England (although, this did make Henry VII the son of King Henry VI's half-brother). The legitimate claim was that of Henry Tudor's wife, Elizabeth of York, as daughter to Edward IV, and descendant of the second son of Edward III, Lionel, Duke of Clarence, and also his fourth son, Edmund, Duke of York. As she had no surviving brothers, Elizabeth had the strongest claim to the crown, but while she became queen consort, she did not rule as queen regnant; for the last attempt a female made at ruling in her own right had resulted in disaster when Henry II's mother, Empress Matilda, and Henry II's uncle, Stephen, King of England, fought bitterly for the throne in the 12th century. Family connections