Then the King had Ferko brought before him , and said , ` You are accused of being a magician who wishes to rob me of my daughter , and I condemn you to death ; but if you can fulfil three tasks which I shall set you to do your life shall be spared , on condition you leave the country ; but if you can not perform what I demand you shall be hung on the nearest tree . '