Sir Ian McKellen ''didn't really know'' who he was at university.

The 'Lord of the Rings' star admits he was still figuring out who he was when he was in education but eventually decided to talk about his sexuality in 1988.

Speaking about his university days, he shared: ''I didn't really know who I was - a closeted gay [at university]. Cambridge was great for me ... all the many parts I had played there, as I loved for the first time going out in public and displaying my emotions. I enjoyed disguising myself as a closeted gay boy.''

And author Gary O'Connor, who has directed Ian a number of plays and has now penned the actor's new biography, has revealed Ian feared how opening up about his sexuality might affect his career.

He wrote: ''Would audiences take his acting seriously, as Romeo for instance, if they knew that in real life he fancied Mercutio rather than Juliet?''

Meanwhile, Ian previously admitted it is the ''greatest regret'' of his life that he didn't tell his parents he is gay.

He said: ''It's the greatest regret of my life that I didn't tell them. My mother died when I was 12 and my father when I was 24, so I didn't talk to either of them about it. I feel sorry for them. I know they'd be happier if they did  ... What's so important about acting that you'd live a lie? How could being successful as an actor be compensation for that?''

Ian had also previously defended his decision to keep his sexuality away from his parents, Denis and Margery, although he thinks they would have accepted that he was a gay man.

He shared: ''What my parents believed in was a Christian view of the world, a non-conformist view of the world in which people cared about each other, whether they knew them or not. They believed that people should always be treated with respect and sympathy, which is why I think if I had come out to my parents it might've been a surprise and a shock to them, but they would have accepted it. That's what I like to think.''