The Kingdom of Great Britain came into being on 1 May 1707, as a result of the political union of the Kingdom of England (which included Wales) and the Kingdom of Scotland. The terms of the union had been agreed in the Treaty of Union that was negotiated the previous year and then ratified by the parliaments of Scotland and England each approving Acts of Union.
Although previously separate states, England and Scotland had shared monarchs since 1603 when James VI of Scotland become James I of England on the death of the childless Elizabeth I, an event known as the Union of the Crowns. The Treaty of Union enabled the two kingdoms to be combined into a single kingdom with the two parliaments merging into a single parliament of Great Britain. Queen Anne, who reigned from 1702 to 1714, had favoured deeper political integration between the two kingdoms and became the first monarch of Great Britain. The union was valuable to England from a security standpoint, since it meant that Scotland lost the possibility to choose a different monarch on her death, reducing the chance of a European power using Scotland as a route to invading England.
Although now a single kingdom, certain aspects of the former independent kingdoms remained separate, in line with the terms in the Treaty of Union: Scottish and English law remained separate, as did the Presbyterian Church of Scotland and the Anglican Church of England. England and Scotland also continued to have divergent systems of education.
The creation of Great Britain happened during the War of the Spanish Succession, in which just before his death in 1702 William III had reactivated the Grand Alliance against France. His successor, Anne, continued the war. The Duke of Marlborough won a series of brilliant victories over the French, England's first major battlefield successes on the Continent since the Hundred Years War. France was nearly brought to its knees by 1709, when King Louis XIV made a desperate appeal to the French people. Afterwards, his general Marshal Villars managed to turn the tide in favour of France. A more peace-minded government came to power in Great Britain, and the treaties of Utrecht and Rastadt in 1713–1714 ended the war.
Queen Anne died in 1714, and the Elector of Hanover, George Louis, became king as George I. Jacobite factions remained strong however, and they instigated a revolt in 1715–1716. The son of James II planned to invade England, but before he could do so, John Erskine, Earl of Mar, launched an invasion from Scotland, which was easily defeated. George II succeeded to the throne in 1727 and ruled until his death in 1760. During his reign, the rising power of Prussia led to two major conflicts in Europe, the War of the Austrian Succession from 1740 to 1748, and the Seven Years War from 1756 to 1763. Both spilled over into the American colonies, and when the latter ended, Britain gained all of Canada and France was destroyed as a colonial power in North America.
Although British sea power proved decisive in the wars, the French navy had become a serious challenger by the middle of the 18th century and an invasion of Britain nearly took place in 1759. After the death of George II in 1760, his grandson became king as George III at the age of 22. Unlike his two predecessors, he was born in Britain and English was his first language. Frequently reviled by Americans as a tyrant and the instigator of the US War of Independence, he ruled for sixty years. George had fifteen children with his queen Charlotte of Mecklenburg; two of his nine sons became kings themselves. Beginning in the 1780s, he suffered recurrent fits of insanity due to being afflicted with porphyria and became totally insane by the last decade of his life.