 In the beginning of the 14th century, it was included into the Grand Duchy of Lithuania and remained there for around 150 years.In the 16th century, it went to the Grand Duchy of Moscow.In 1581, in the course of the Livonian War, it was transferred to Poland, and stayed here until 1678, when the northern part of the area was transferred to Russia.