The National Bank of Scotland was founded as a joint stock bank in 1825. Based in Edinburgh, it had established a network of 137 branches at the end of its first hundred years. In 1918 the bank was bought by Lloyds Bank, although it continued to operate as an independent institution until 1959, when it merged with the Commercial Bank of Scotland to become the National Commercial Bank of Scotland. Ten years later the National Commercial Bank merged with the Royal Bank of Scotland.