 In 1576 Báthory became the third elected king of Poland.He worked closely with chancellor Jan Zamoyski.The first years of his reign were focused on establishing power, defeating a fellow claimant to the throne, Maximilian II, Holy Roman Emperor, and quelling rebellions, most notably, the Danzig rebellion.