Bartoszyce (pronounced AUDpl-Bartoszyce.oggbarto'szyce, Bartenstein, ˈbaʁtn̩ʃtaɪn; Barštynas) is a town on the Łyna River in northern Poland, with 22,597 inhabitants as of December 2021. It is the capital of Bartoszyce County within the Warmian-Masurian Voivodeship. Bartoszyce lies on the left shore of river Łyna River in a valley, approximately east of Elbląg and south of Kaliningrad, at an altitude of above sea level. Around 1241 the Teutonic Knights (the monastic German Order) constructed a castle on the left shore of the Łyna River on the border between the Old Prussian regions of Natangia and Bartia. The castle was part of the district (Komturei) of Balga. It was first composed of stone houses, palisades, and earthworks and later built of bricks. Besieged by the native Old Prussians for four years during an uprising beginning in 1260, the castle was destroyed in 1264. The Order rebuilt it shortly afterward, but it was besieged by another Baltic group, the Sudovians, in 1273. After the Old Prussian uprisings ended, the Knights rebuilt the Ordensburg out of stone from 1274–80. During the 14th and 15th centuries, the castle was managed by the Komtur (administrator) of Balga. Thereafter, a settlement developed near the castle on the right shore of the Alle River opposite the castle. First documented in 1326 under the name Rosenthal, it received town privileges from the Teutonic Grand Master Luther von Braunschweig in 1332. After that the name was changed to Bartenstein and the settlement of Rosenthal below the castle on the left shore of the river was relocated, as the left side had become too endangered by warfare. Poles settled in sizeable numbers in Bartenstein from the 14th to the 17th century. The town's Polish residents used the Polish names Bartoszyce and Barsztyn. The town's Teutonic Order administrator (German: Komtur), Henning Schindekopf of Balga, began construction of a wall around the town in 1353. In 1440, the town joined the anti-Teutonic Prussian Confederation, upon the request of which Polish King Casimir IV Jagiellon incorporated the region and town to the Kingdom of Poland in 1454.