Before the Magdeburg rights were granted to Vilnius in 1378, the city was overseen by the ruler's vicegerents. Later these duties were granted to a magistrate or a City Council, subordinate only to the ruler himself. During wars, when the city was in a danger, the city was led by a Voivode of Vilnius. The magisterial authority was headquartered at the Vilnius Town Hall.