Leonard Nimoy was the dearest friend I have ever known, but we didn’t become pals until after we stopped playing Captain Kirk and Mr Spock on TV.

In fact, while we were working together, I don’t think Leonard even liked me — and I can’t blame him.

Honestly, until Leonard and I developed our relationship, I never — with the exception of my wives — had a real friend. There had never been anyone in my life to whom I could unburden myself completely.

We had no way of guessing that we would form a lifelong bond when we first met on the Star Trek set in 1965. I’m sure we were polite.

Scroll down for video

Close: William Shatner and Leonard Nimoy became best friends after they met filming TV show Star Trek

But I doubt either of us even remembered that we had worked together before, a year earlier — on an episode of The Man From U.N.C.L.E. where I played a drunken bon vivant and he was the Russian bad guy. Nor did we have the slightest hint that we were creating two of the most iconic characters in American TV history.

I was keenly aware how lucky I was to be there at all. The role of James Tiberius Kirk, commander of the Starship Enterprise, had been given to Jeffrey Hunter, but after the pilot episode Hunter’s wife started to make extraordinary demands.

She stormed into production meetings, and insisted that ‘my Jeff’ could only be shot from the most flattering angles. Star Trek’s creator, Gene Roddenberry, decided he wasn’t going to stand for that, and fired Jeffrey. First choice to replace him was Jack Lord, who went on to star in Hawaii Five-O, but Jack asked for 50 per cent ownership of the show.

So Gene called me. He needed a blond, bright-eyed actor to play opposite the starship’s first officer, the dark and brooding Mr Spock. Leonard showed little emotion; mine were constantly on display and constantly changing.

But I suspect Roddenberry felt I was the perfect choice because I wasn’t too intelligent for the audience, and he didn’t have to pay me a lot of money.

From the start Spock received the most fan mail. I hadn’t expected that and I was not thrilled about it. I had the most lines, I was fronting most of the publicity, my character carried the storyline. James T. Kirk got the girl and saved the ship every week.

Giddyup: The buddies attended the 'Hollywood Charity Horse Show' at the Los Angeles Equestrian Center in 2009

Tragic losses: Shatner with his wife Nerine, who died soon after they married. Shatner writes: 'I had no concept of what alcoholism really was. I’d see that Nerine drank too much, and I’d worry, but she always had an excuse that I was too ready to accept'

But it was Leonard’s spectacular performance that occupied all the attention. Spock fan clubs were formed, and every magazine and newspaper ran features on this cold, logical man from planet Vulcan, a character unlike any seen on TV before.

A memo came down from on high that every episode had to feature Mr Spock prominently. I was beginning to get insecure and jealous, so I went to Gene. He told me: ‘Don’t be afraid of having popular and talented people around you. They can only enhance your performance.’

That helped, but I was very conscious Leonard was a highly trained classical actor, and I was not. He ran a studio, teaching the Method technique used by stars such as Marlon Brando and Dustin Hoffman.

My style is the classic non-technical technique: I memorise the lines and play the character. I didn’t understand, at first, how seriously Leonard took his Method. But I found out.

We were shooting an early episode called The Devil In The Dark. Spock makes contact with a strange, underground creature called a Horta, using a kind of telepathic connection. It comes at an agonising psychic cost, and forces Spock to his knees, crying: ‘Pain! Pain! Pain!’

When the time came for the camera to shoot my reactions, I asked him to replay the scene, which he obligingly did. He didn’t rush it — he felt the emotion and cried out from the depths of his soul: ‘Pain! Pain! Pain!’

I went for the cheap joke and yelled, ‘Hey, someone get this guy an aspirin!’ Then I waited for a laugh that never came.

Better together: The USS Enterprise captain writes about his personal relationship with poker-faced first officer in Leonard: My Fifty-Year Friendship With A Remarkable Man

Cutting up: Nimoy puts a new spin on his famous Vulcan neck pinch at a signing for 'Mind Meld: Secrets Behind the Voyage of a Lifetime'

Team: Shatner writes that 'We had fun, but we weren’t close. He wasn’t an easy man to know, keeping a respectful distance between himself and the rest of the cast'

Leonard was absolutely furious. He thought I’d set him up for ridicule. He stalked off the set but confronted me later, telling me that he thought I was ‘a real son-of-a-bitch’.

My apology must have sounded hollow because he didn’t say a word to me that wasn’t in the script for at least a week.

That didn’t cure me of playing pranks on him, though. My favourite involved his bicycle: he used to ride it to the studio canteen, to be first in the lunch queue. I protested that this was unfair, and he should walk like the rest of us. He retorted that a bike was ‘the logical thing to do’.

So I borrowed his bicycle one morning and persuaded the crew to hoist it above the set on ropes. When Leonard went to lunch, he thought it had been stolen . . . until I urged him to ‘look to the stars for the answer’. There it was, above his head.

For my next trick, I chained the bike to a fire hydrant. Leonard started coming in to work with bolt-cutters. So I brought one of my Doberman Pinschers into the studio and shut it in my dressing-room . . . with Leonard’s bike.

‘Door’s open,’ I told him. ‘If the dog attacks you, just reach into its mouth and grab its tongue.’

Later, Leonard said: ‘That dog is meaner than you. And that’s not easy.’

Leonard hated to be beaten. He drove his car, a gigantic Buick, on to the lot and locked the bicycle inside. So I arranged for the car to be towed away.

After that, Leonard agreed to walk to the canteen.

We had fun, but we weren’t close. He wasn’t an easy man to know, keeping a respectful distance between himself and the rest of the cast. We thought it was part of his Method, to do with sustaining the alienation of Spock from the crew of the Enterprise. But much later, I discovered the darker reason.

The stars are born: Nimoy and Shatner in a scene from 'The Man Trap,' the premiere episode of Star Trek, which aired on September 8, 1966

Retro: William Shatner and Leonard Nimoy attend a Paramount Studio press conference about the new "Star Trek" movie in Los Angeles in March 1978

Leonard was an alcoholic. He kept this a secret while we were filming the TV show but much later, when he was in recovery, he talked about the problem publicly.

He wanted to save people the pain that he had endured.

He started drinking heavily around 1967, during the second series of Star Trek. He had always enjoyed a glass or two of wine after filming, but gradually the ritual became so important that it took over his whole personality.

When he directed, a secretary was on standby to bring him a drink in a paper cup, the moment the last shot was in the can.

Leonard was an alcoholic. He kept this a secret while we were filming the TV show but much later, when he was in recovery, he talked about the problem publicly. William Shatner

He hid this from the cast, never allowing it to affect his work. But on days off, he did nothing but booze. He’d break open the beer at 11am and drink steadily, until he passed out around 4pm.

He wouldn’t regain consciousness until the next day, when he started drinking again.

Part of his problem was the sheer disappointment of stardom. He had been a struggling actor since his teens, making ends meet through various jobs, including driving a cab — he once ferried John F. Kennedy to the Beverly Hilton, where the then Massachusetts senator, distracted, walked off without paying.

Leonard followed him, telling him: ‘I want my $1.25,’ before Kennedy borrowed $3 from someone he knew to settle up.

Now, in his mid-30s, Leonard was the most recognisable face on TV. Everyone knew Spock, even John Wayne, who clapped his hands on Leonard’s shoulders at a party and said: ‘Great! You fixed your ears!’

But though it brought him the love of his public, fame didn’t seem to bring him respect from the studio bosses. What he got was endless problems with producers, accountants and lawyers. That’s the way TV was in the Sixties.

If he asked for a phone in his dressing room, they’d tell him it wasn’t in his contract, either. If he wanted to leave the studio half-an-hour early, to see his family — he was married with a son and daughter — that wasn’t in his contract either. If he protested, the executives would threaten to ‘get another guy to wear the ears’.

Classics: Nimoy created the Vulcan neck pinch and the salute that he confessed he learned in synagogue during the benediction when the feminine counterpart to God, the Shechinah, enters to bless the congregation

Actor: William Shatner, who won best supporting actor in a series, mini-series or television movie for his work on 'Boston Legal', arrives with his wife, Elizabeth, for the 62nd Annual Golden Globe Awards in January 2005

The strain on his family life was tremendous. He worked as hard as he could, because acting was his vocation and his prime means of supporting his family. But the studio chiefs often bent the rules in their own favour.

Leonard was beside himself with anger when he found out on a trip to London that his face was being used to sell beer in Britain. He hadn’t agreed to it — or been paid a penny.

To add to his pressure, his first wife Sandi was a force of her own, who wore groovy clothes and loved rock ’n’ roll.

The Nimoys even went to love-ins, parties where people explored their intimate feelings together. ‘It wasn’t quite group sex,’ he told me, ‘but there was a lot of embracing.’

Leonard kept drinking hard until well after his marriage had broken down and ended in divorce in 1986.

It was neither easy nor amicable. Even at the most difficult moments of his life, his fame intruded: the divorce judge actually brought a photo of Spock into the courtroom and asked for an autograph.

Drink controlled his behaviour during those years. He drifted away from American theatre, but loved to see shows in Britain because he could get a drink before the curtain went up, and again during the interval.

But by 1989 he had married again, to a wonderful woman called Susan Bay — cousin of Hollywood director Michael Bay [whose hits include the epic war film Pearl Harbor and the sci-fi action series Transformers].

‘I was still drinking,’ Leonard told me, ‘but I was deliriously happy with her.

‘One day I was talking to her about how happy I felt, and she asked me: “Then why do you drink so much?” And I knew she was right. I didn’t have to do this any more. So she called a friend, and within hours someone was there from Alcoholics Anonymous. We talked for two hours, and I haven’t had a drink since that conversation.’

By the time Leonard kicked booze, we had been the closest of friends for 20 years. Partly it was the discovery of our shared past that brought us together: we had similar childhoods, both raised in lower middle-class Orthodox Jewish immigrant families.

We both defied our parents to become actors, and we were even distantly related, by marriage.

We came from the same tribe, Jews who fled Eastern Europe to escape persecution, and we were born within days of each other in March 1931. Since I was four days older, I could claim to be the wiser of us, though Leonard liked to remark: ‘You’re a lot older than I am!’

We started to discover the similarity in our backgrounds after the first unofficial convention of Star Trek fans was held in 1969. Trekkies gathered at the public library in Newark, New Jersey, to listen to lectures, join panel discussions and sing songs inspired by the show.

Trekkies — what an odd term. But these conventions were soon a multi-million-dollar business. Contrary to what anyone might have expected, Leonard embraced it. He’d turn up with his guitar, tell a lot of stories and sign autographs for everyone.

Gods: Shatner as Captain James T. Kirk and Nimoy as Mr. Spock in the Star Trek episode, 'Plato's Stepchildren' that aired in November 1968

Rift: Shatner was making a film about the captains of the Enterprise and Leonard didn't want any part of it. A cameraman shot him at a convention and it was included in the film. Leonard never spoke to Shatner again

Partly it was the money he’d earn, big fat envelopes filled with cash. But he also attended conventions where he didn’t get paid a cent.

Leonard was like an autograph machine. He holds the all-time record: 1,700 signatures in an hour, which is approximately one every two seconds.

Once, when he was racing to catch a flight, I saw him work his way up a queue, asking each person to turn round so he could sign memorabilia against their back. When he reached the door, he leapt into a taxi. His attitude to Spock was always ambivalent, though. He knew he owed the character his success, but he also wanted the world to know what else he could do — his photography, his poetry, his songs.

He was the most multi-talented man I have ever known, but he will always be associated with a single role. He called the first volume of his autobiography, I Am Not Spock — and the second, I Am Spock.

We understood each other so well that, when my second marriage broke down in 1996, it was Leonard and Susan who helped me get over it. And when I fell in love again, with Nerine Kidd, a model and actress, they were the first to know.

I had no concept of what alcoholism really was. I’d see that Nerine drank too much, and I’d worry, but she always had an excuse that I was too ready to accept. After one evening at the Nimoys, Leonard remarked that Nerine had been ‘erratic in her behaviour’. That was a nice way of describing it.

First: The actors actually met in 1964 during the spy television show, The Man from U.N.C.L.E. starring Robert Vaughn (right). But neither recalled the meeting. In 'The Project Strigas Affair' Shatner played a pest control business owner recruited to convince Communist spy Nimoy that he has the secret to a nerve gas formula

Union: Leonard's own family said he was disconnected from family issues. He and his wife, Sandi (above) had participated in 'love-ins' pursuing sexual freedom. 'It wasn't quite group sex—but there was a lot of embracing'

‘Bill,’ he said, ‘you know she’s an alcoholic? You’re in for a rough ride.’

He tried to help her, talking with her, taking her to AA meetings.

Finally, I decided the way to cure her was to marry her, in the hope that my love would take the place of alcohol as the crutch in her life.

Leonard talked with me, too. He believed I was making a terrible mistake and wanted to offer advice. That was brave and selfless: in situations like that, it is often the messenger who gets shot.

But it was Nerine who died, not long after our wedding in Pasadena, where Leonard was my best man — standing tall and impeccably dressed as ever in a tuxedo.

My wife’s drinking had escalated. The monster had her in its grip and would not let go.

I came home one night and found her body, lifeless and drowned, in the swimming pool. I turned to the only real friend I had for support.

Leonard enveloped me in his arms as a brother, and we cried together. He was always there.

It pains me deeply that, during the last few years of his life, we weren’t so close. There was a small incident: I was making a film about the many captains of the Enterprise, and Leonard didn’t want to be in it. I thought he was kidding, and used some film taken at a convention without his permission.

It breaks my heart that we were not reconciled before his death, last year, from lung disease.

I wrote to him, to tell him: ‘I love you like a brother. You’re the friend that I have known the longest and the deepest. You’re a wonderful man and I, along with so many other people, think so highly of you.’

He wasn’t a man for extravagant gestures, but I’ll always treasure one memory, when he was looking at a photo of us together in our Star Trek uniforms and mused aloud that we were ‘Siamese twins’.

Then, unexpectedly, he threw his arm around my shoulders and blurted: ‘You’re my best friend!’