Berwick Castle was built by King David I of Scotland about 1127 and by 1160 it had become a substantial fortress. In 1174 the Scottish King, William the Lion was defeated and captured at the Second Battle of Alnwick. To secure his release, both the castle and the town were passed to the English the following year under the Treaty of Falaise. King Henry II made some modifications but after he died in 1189 Richard I (Richard the Lionheart) became King of England and to help fund the Third Crusade he sold both the town and castle back to the Scots.
In 1292 Edward I of England announced his support for the anointing of John Balliol as King of Scotland. However, John defied Edward, thus promoting the First War of Scottish Independence and in 1296 Edward seized Berwick Castle, using it as his headquarters during his subsequent invasions of Scotland. He oversaw the "sacking" of the town, killing about 8,000 inhabitants and had Balliol removed as King as placed in the Tower of London. During his reign Edward had the castle substantially improved and the town fortified. The Great Hall was used by Edward to receive defeated Scottish Nobles. In 1297 William Wallace led a Scottish army in an attack on Berwick. Although the town fell the castle did not and the following year Wallace and his army withdrew from the town.
In 1306 Robert the Bruce rebelled against Edward and was crowned King of Scotland. Edward prepared his armies to march north but unfortunately he died whilst camped waiting. His son ,Edward II was not like his father and allowed Robert to slowly reduce the English garrisons in Scotland. By 1314 only Stirling and Berwick held out. Following the English defeat at The Battle of Bannockburn several attempts were made to besiege the town until eventually in 1318 it fell, followed six days later by the castle. Edward attempted unsuccessfully to recapture the castle, but in 1333 his son, Edward III eventually managed to capture the town and the castle despite the First war of Scottish Independence ending in 1328.
In 1355, during The Second War of Scottish Independence a surprise Scottish attack recaptured Berwick but withdrew the following year. Although the war formally came to an end in 1357 with The Treaty of Berwick border disputes continued and in 1377 seven Scotsmen captured the castle, but it was retaken then same year. In 1461 during the War of the Roses the castle was ceded to the Scots by Queen Margaret of Anjou in exchange for support for the Lancastrian cause. In 1482 Richard, Duke of Gloucester (Richard III) captured the castle for the last time.
During the reigns of Henry VII and Henry VIII modifications were made. However when upgrades were made to Berwick's Town Wall defences in the 1500's the castle was not improved and was left to slowly become ruinous. In 1603 when James VI of Scotland inherited the English throne the castle was sold to George Home, Earl of Dunbar. George started the process of converting the castle into a grand residence but when he died in 1611 work on the castle was stopped and it was left to slowly fall into ruin.
Unfortunately in 1844 and again in 1850 when work on the railway lines commenced much of the remaining structures of the castle were demolished, including The Great Hall. What remains of this once great castle can be viewed from the riverside.