Actors William Shatner (left) and Leonard Nimoy, who died Friday, smile during an interview for the 40th anniversary of the science-fiction television series "Star Trek" in Los Angeles Aug. 9, 2006. In real life, the men were close friends. Photo: Reuters/Mario Anzuoni

“Star Trek” fans have loved to analyze the relationship between Capt. Kirk and Mr. Spock, both on and off set. But the death Friday of Leonard Nimoy, 83, who played Spock, the iconic half-human, half-Vulcan character in “Star Trek,” may finally lay to rest speculation about the relationship between him and his co-star, William Shatner, who played Kirk. The two men were bound together for better or for worse, not just as fictional characters in the service of the United Federation of Planets but also much more deeply in the real world.

Most of the rumors about a feud between the actors derived from anecdotes dating back to when Shatner was chosen to play Kirk in the original “Star Trek” television series in the mid-1960s and was in some ways subsequently outshone by Nimoy’s character, Spock.

“I was supposed to be the star, but Leonard was getting more attention than I was. It bothered me,” Shatner later wrote of the relationship between Nimoy and himself when they first began acting in the “Star Trek” series. As a result, “Leonard and I argued early on,” Shatner wrote in his “Up Till Now: The Autobiography,” which was published in 2009.

“On the set, he [Nimoy] remained aloof. He claimed this was partly to maintain the character’s integrity,” Shatner wrote. “Spock was an outsider, and Leonard worried if he got too friendly with the cast, he might close that distance.” But if they weren’t so friendly at that time, Shatner wrote, they eventually resolved their differences, becoming involved in each other’s lives in unexpected ways.

“Leonard Nimoy’s personal experience of alcoholism ... came to play a central role in my life, and it helped us bond together in a way I never could have imagined in the early days of ‘Star Trek,’” Shatner wrote.

Shatner’s wife in the late 1990s was an alcoholic, an issue Nimoy noted and pointed out to her husband. He attempted to help, bringing her to Alcoholics Anonymous meetings, but she eventually passed away because of an alcohol- and drug-related accident.

In addition to the hit “Star Trek” TV series and films, the two actors also appeared together more recently in several commercials for Priceline and Volkswagen.

“Look, everybody knows that we have become very, very good friends. But we’ve always been like two competitive siblings,” Nimoy said at the first Hero Complex Film Festival in 2010. And he elaborated on their relationship, saying: “When Bill Shatner heard I was going to direct a ‘Star Trek’ movie, he went into deep shock. He was really worried. But it worked out pretty well.”