During Spanish colonization of Mexico from 1519 to 1810, any relations between New Spain and the Commonwealth of Poland would have been via Spain. After some time, while Mexico was obtaining its independence from Spain, Poland, by contrast, was finding itself being invaded and split among the Kingdom of Prussia, the Austro-Hungarian Empire and the Russian Empire. At the end of World War I and after the signing of the Treaty of Versailles, Poland obtained its independence once more.