The Kingdom of Livonia was a nominal state in what is now the territory of the present-day Estonia and Latvia, declared as such by Ivan IV during the Livonian War but never properly established. On June 10, 1570 the Danish Duke Magnus of Holstein arrived in Moscow where he was crowned King of Livonia. Magnus took the oath of allegiance to Ivan as his overlord and received from the corresponding charter for the vassal kingdom of Livonia in what Ivan termed his patrimony. The treaty between Magnus and Ivan IV was signed by an oprichnik and by a member of the zemskii administration, the d'iak Vasiliy Shchelkalov. The territories of the new kingdom still had to be conquered, but even so Põltsamaa Castle was proclaimed the future official residence of the king. The new king Magnus of Livonia left Moscow with 20,000 Russian soldiers on the conquest of Swedish controlled Reval. Ivan’s hope of the support of Frederick II of Denmark, the older brother of Magnus, failed. By the end of March 1571 Magnus gave up the struggle for Reval and abandoned the siege.
In 1577 having lost Ivan's favor and getting no support from his brother, Magnus called on the Livonian nobility to rally to him in a struggle against foreign occupation. He was attacked by Ivan's forces and taken prisoner. On his release he renounced his royal title. Magnus spent the last six years of his life at the castle of Pilten in the Bishopric of Courland where he died as a pensioner of the Polish crown.