The Prince was fortunate enough to be able to lay hold of a floating spar , and contrived to keep himself afloat ; and , after a long struggle with the winds and waves , he was cast upon a strange island .