Łuków was established as a grod, around the year 1233. It guarded eastern border of the Sandomierz Land, against warring tribes from the East including the Yotvingians and the Lithuanians. In the first half of the 13th century, Łuków was the seat of Lesser Poland's castellany, positioned in a strategic corner of the province. After prince of Kraków and Sandomierz Bolesław V the Chaste brought here the Knights Templar (1250–1257), a Roman Catholic "Diocese of Łuków" was established here. It existed for a very short time (1254–1257), and was closed after protests of the Teutonic Knights. In the late Middle Ages, Łuków was frequently invaded and destroyed by the Old Prussians, Yotvingians, Lithuanians, and Tatars. The city life improved only after 1385 (see Union of Krewo), when Poland and Lithuania became allies. In 1403, Łuków was officially granted a charter, codifying its legal status. The town originally belonged to the Sandomierz Voivodeship, but in 1474, it became part of the Lublin Voivodeship (1474–1795).