Around 1255 the locality was fortified, but the castle was surrendered to the Teutonic Knights by its mayor, Tirslo. The Teutons continued to use the castle and began to colonize the region with Germans, giving the settlement the name Wehlau. It received its civic charter in 1335 and in 1339 and became a centre for horse stables and horse trade. Until the late 19th century the town was allowed to organise a six-day linen fair, a three-day horse fair and two additional horse and cattle fairs every year. In 1349 Grand Master of the Teutonic Order Heinrich Dusemer founded a Franciscan Monastery there to commemorate his victory over the Prussians in the battle of Streba River. In 1380 the St. Jacob's church was erected.