The long-awaited referendum on independence for Scotland is finally happening this week, as Scots vote yes or no to the question of whether they want their nation to become independent from the United Kingdom. If a majority votes yes, Scotland will end its 307-year-old union with England and Wales and become an independent nation with some 5.3 million people. Ahead of the referendum, we take a look back at some of the key moments in Scotland’s long and rocky relationship with its neighbors.

Wars of Independence
When King Alexander III died in 1286, Scotland was left without a ruler. His children were all dead, so his three-year-old granddaughter Margaret, known as the “Maid of Norway,” succeeded to the throne. When she fell ill during the sea voyage from Norway to Scotland and died, 13 rival noblemen stepped forward to stake their claim on the throne. To settle the question, the interim government (known as “guardians”) turned to King Edward I of England, who made all the claimants promise to accept him as overlord of Scotland, which they grudgingly did. Edward’s pick, John Balliol, became king of Scotland over the other leading contender, the sixth Robert de Bruce.

Balliol’s reign kicked off the bloody Wars of Independence, as Scottish landowner William Wallace led the resistance to English rule. Wallace’s forces triumphed at the Battle of Stirling Bridge in 1297, but lost at Falkirk the next year, and the English would capture and execute Wallace in 1305. In 1306, when the eighth Robert de Bruce (better known as “Robert the Bruce”) seized the Scottish throne from his rivals, England’s King Edward I moved swiftly to crush his revolt, imprisoning Bruce’s wife and daughter and executing his brothers in brutal fashion. After escaping the king’s wrath himself, Bruce began a guerrilla war against his English and Scottish enemies, culminating in the decisive victory of his supporters over the troops of Edward II at the Battle of Bannockburn in 1314. In 1328, England finally renounced overlordship over Scotland in the Treaty of Northampton, cementing Robert the Bruce’s status as Scotland’s preeminent hero-king.

Mary and Elizabeth
Thanks to a long-standing alliance with France, Scotland had support in its continuing struggles with England over the centuries after Robert the Bruce declared its independence. When King Henry VIII ordered an invasion of France in 1513, Scotland’s King James IV subsequently invaded England, but died on the battlefield during his troops’ defeat in the Battle of Flodden. His granddaughter, Mary Queen of Scots, grew up in France and married the future King Francis II at the age of 15. Two years later, Francis died and Mary returned to Scotland, then in the throes of the Protestant Reformation.

When her cousin Elizabeth I took the English throne in 1558, Mary was her leading rival for power, as many Roman Catholics believed Mary was the rightful queen due to Elizabeth’s supposed illegitimacy (her father, Henry VIII, had divorced Catherine of Aragon to marry Elizabeth’s mother Anne Boleyn). After Mary was suspected in being complicit in the murder of her husband, she sought refuge in England but was instead kept captive there for some 18 years. Another plot against Elizabeth surfaced in 1586, and the Protestant queen had her Catholic cousin tried for treason and executed. But in 1603, when Elizabeth I died without children, the English throne went to Mary’s son, King James VI, uniting the two crowns after centuries of simmering tensions.

Acts of Union
In 1707, just over a century after King James VI of Scotland became King James I of England, the Acts of Union formally united Scotland with England and Wales as Great Britain. The union came about after a period of upheaval (including the Glorious Revolution of 1688-89) and tensions between the separate parliaments of England and Scotland. Scotland gained economic security from the agreement, while England got increased manpower and resources, as well as political safeguards against possible invasion by the French or the Jacobites (the supporters of King James II, exiled after the Glorious Revolution, and his successors).

Not everyone in Scotland supported the union, however, and many resented answering to lawmakers in London. In 1745, Bonnie Prince Charlie, great-grandson of James VI, launched an invasion of England from France to claim the throne for his family. After that rebellion was easily crushed at the Battle of Culloden in 1746, the British government placed heavy restrictions on the Scottish people, ending any hopes of independence for the next two centuries.

Rise of Scottish Nationalism
In 1934, the Scottish National Party (SNP) was founded, making its primary goal the future independence of Scotland. The party gradually began gaining ground after World War II, bolstered by the discovery of rich oil resources in the North Sea in the 1970s. In 1974, the SNP won 30 percent of the Scottish vote and 11 seats in Parliament after campaigning on the slogan “It’s Scotland’s oil!”

In a referendum in 1997, Scottish voters voted in favor of devolution of powers, which meant that although Scotland remained part of the United Kingdom, its government gained a broad range of new powers, including control of education and health care, and (for the first time since 1707) a Scottish Parliament.

Voting Yes or No on Independence
In 2007, the SNP won an upset victory in the Scottish parliamentary elections, ending some 50 years of Labour Party dominance; SNP leader Alex Salmond was elected first minister of Scotland, the top government post. He won a second term in 2011 and was able to use his party’s historic mandate to secure approval for a referendum on independence for Scotland. In 2012, Salmond and British Prime Minister David Cameron signed an agreement to hold that referendum in 2014. Subsequent negotiations lowered the voting age in the referendum for 16 and determined that it will pose a single question: “Should Scotland be an independent country?”