After the great schism, Novgorod struggled from the beginning of the 13th century against Swedish, Danish, and German crusaders. During the Swedish-Novgorodian Wars, the Swedes invaded lands where some of the population had earlier paid tribute to Novgorod. The Germans had been trying to conquer the Baltic region since the late 12th century. Novgorod went to war 26 times with Sweden and 11 times with the Livonian Brothers of the Sword. The German knights, along with Danish and Swedish feudal lords, launched a series of uncoordinated attacks in 1240–1242. Novgorodian sources mention that a Swedish army was defeated in the Battle of the Neva in 1240. The Baltic German campaigns ended in failure after the Battle on the Ice in 1242. After the foundation of the castle of Viborg in 1293 the Swedes gained a foothold in Karelia. On August 12, 1323, Sweden and Novgorod signed the Treaty of Nöteborg, regulating their border for the first time.