From late middle ages to 1795, the city was of the Grand Duchy of Lithuania, which later became a part of the Polish–Lithuanian Commonwealth from 1569. In 1795, it was occupied by the Russian Empire with the Partitions. After World War I, the city was conquered by the Second Polish Republic. In 1939, during the Invasion of Poland by Nazi Germany and the Soviet Union, the city was first captured by the Wehrmacht and soon passed on to the USSR per the German–Soviet Frontier Treaty. In 1941, it was retaken by the Germans during Operation Barbarossa. The city was in the Belarusian SSR until the breakup of the USSR in 1991. Since then, Brest is part of Belarus.