 In fact, the Emperor authorised Matthias to start negotiations with Bocskai.The resulting agreement was included in the Treaty of Vienna, which granted religious freedom to Hungarian Protestants and prescribed the election of a palatine (or royal deputy) in Hungary on 23 June 1606.The subsequent Peace of Zsitvatorok put an end to the war with the Ottoman Empire on 11 November 1606.