Independent for over 300 years , Iceland was subsequently ruled by Norway and Denmark .