The personal union with the United Kingdom ended in 1837 when Queen Victoria became the queen of the UK. This was because females were not allowed to rule Hanover while a related male was still alive. Because of this, her uncle Ernest Augustus thus became the ruler of Hanover. His only son took over from him as George V. However, he was on the losing side of the Austro-Prussian War. His kingdom was then taken over by Prussia in 1866 and lost independence. It became a Prussian province. Hanover became part of the German Empire with the unification of Germany in January 1871. The country came back as the State of Hanover in 1946. But this state was later merged with some smaller states to form the current state of Lower Saxony in then West Germany. The city of Hanover became the capital of this new state.