John Gavin, who reached the pinnacle of his acting career with roles in Douglas Sirk’s “Imitation of Life,” Alfred Hitchcock’s “Psycho” and the epic “Spartacus,” later serving as president of the Screen Actors Guild in the early ’70s and as U.S. ambassador to Mexico under Ronald Reagan, died Friday morning in Beverly Hills, Calif. He was 86.

The actor was signed to a contract and almost played James Bond in the film “Diamonds Are Forever.”

Gavin was SAG president from 1971-73 and was President Reagan’s first ambassador to Mexico from 1981-86.

His two films with German-born director Douglas Sirk in the late 1950s, “A Time to Love and a Time to Die” and “Imitation of Life,” greatly raised his profile in Hollywood and around the country.

Shot in black-and-white CinemaScope, and adapted from the novel by “All Quiet on the Western Front” author Erich Maria Remarque, “A Time to Love and a Time to Die” (1958) was the first film in which Gavin starred, and the Sirk melodrama was remarkable for its sympathetic portrait of Germans near the end of WWII — made just 13 years after that war to defeat the Nazis had ended. Gavin portrayed a weary German soldier returning from the Russian front to a Hamburg destroyed by Allied bombing. Fruitlessly searching for his family, he falls in love with fellow orphan Elisabeth (Liselotte Pulver), but both of them know he must return to the front.

Critic Daniel Green wrote: “As with any Sirk melodrama, however, ‘A Time to Love and a Time to Die’ inevitably comes to hinge upon the on-screen chemistry between its two love-struck leads. Fortunately, audiences were/will once again treated to yet another masterclass in romanticism, as Ernst and Elisabeth’s potentially blissful future is briefly glimpsed before being tragically snatched away in a cruel, almost trademark twist of fate.”

The Los Angeles Times said the film, while not as good as “All Quiet on the Western Front,” was “vivid, sometimes brutally shocking and, less often, emotionally moving,” while Gavin gave a “sensible, likeable” performance.

Sirk followed with a remake of the 1934 film “Imitation of Life” that was the biggest box office success at Universal until “Airport” in 1970 and the fourth-most successful film of 1959 overall, grossing $6.4 million. That film, dismissed by many critics at the time as a soap opera, is now generally considered a masterpiece of complex storytelling.

In a 2015 review, the Village Voice said, “Fifty-six years after it opened, Douglas Sirk’s ‘Imitation of Life’ remains the apotheosis of Hollywood melodrama — as Sirk’s final film, it could hardly be anything else — and the toughest-minded, most irresolvable movie ever made about race in this country.”

The success of the film was good for his career, but it did not do well because of Gavin. Though he was second billed after Lana Turner, his character was ancillary to the main storyline involving two mother-daughter pairs. Gavin’s Steve Archer loves Turner’s Lora Meredith but is rejected by her; he later becomes involved with Lora’s daughter, played by Sandra Dee, but he rejects her because he still loves Lora.

He next appeared in the Michael Curtiz-directed “A Breath of Scandal,” starring Sophia Loren and Maurice Chevalier, but far more important was the film after that: Hitchcock’s “Psycho,” in which he played Sam Loomis, the boyfriend of Janet Leigh’s Marion Crane, who frets that they don’t have enough money, steals some from the office where she works, drives to a secluded motel and…. Just as in “Imitation of Life,” Gavin’s role in “Psycho” was not central, but despite the initially mixed critical reception, the film was an extraordinary box office success, which benefitted all associated with it.

His next film was the Stanley Kubrick-directed “Spartacus,” starring Kirk Douglas as the slave who leads a rebellion in Ancient Rome. Gavin played the supporting role of Julius Caesar, who is the protege of Roman Senator Gracchus (Charles Laughton), who uses this rebellion to advance the career of Caesar. The film was extraordinarily successful at the box office and won four Oscars.

Gavin next appeared in a supporting role in the mystery-thriller “Midnight Lace,” starring Doris Day and Rex Harrison, and he starred with his “Spartacus” co-star Peter Ustinov and Sandra Dee in the Ustinov-written and -directed “Romanoff and Juliet,” a satirical love story set against the backdrop of the Cold War, and again with Dee in the comedy “Tammy Tell Me True.”

Gavin also starred in the mediocre melodrama “Back Street” with Susan Hayward and Vera Miles.

At this point Gavin began transitioning to television roles, but he let out his frustrations over his film career in an interview with Hedda Hopper: “When I walked through the gate, Universal quit building actors. All of a sudden I was doing leading roles. I knew I was a tyro but they told me to shut up and act. Some of those early roles were unactable. Even Laurence Olivier couldn’t have done anything with them. The dialog ran to cardboard passages such as ‘I love you. You can rely on me darling. I’ll wait.’ It was all I could do to keep from adding, ‘with egg on my face’ … There was no studio system to let me work my way up through small roles. When I got up on my hind legs, no one would believe it.”

He starred in ABC’s single-season Western “Destry” in 1964; in NBC’s single-season WWII drama “Convoy” in 1965; and guested on shows ranging from “The Doris Day Show” to “Mannix.”

In the late ’60s he returned to film work, starring in Carlos Velo’s Spanish-language art film “Pedro Paramo,” based on the novel that Susan Sontag called “one of the masterpieces of 20th-century world literature.” Also in 1967 he had a supporting role in the Julie Andrews musical “Thoroughly Modern Millie.” The following year he starred in Italian-French spy thriller “OSS 117 — Double Agent,” and Gavin had a supporting role in “The Madwoman of Chaillot” (1969), starring Katharine Hepburn.

After the departure of George Lazenby, Gavin was signed to play James Bond in the 1971 film “Diamonds Are Forever,” but United Artists ultimately decided to make an offer that Sean Connery couldn’t refuse, and he returned to play 007. Gavin’s contract was nevertheless honored in full.

He continued doing TV guest appearances until 1981.

John Anthony Golenor was born in Los Angeles, a fifth-generation Angeleno on his father’s side, descended from early Spanish land owners in colonial California; his mother was a Mexican-born aristocrat. His father, however, changed the family surname to Gavin.

He graduated from Stanford University with a B.A. in economics and Latin American affairs, completing senior honors work in Latin American economic history; Gavin later said that while in college he had no interest in acting whatsoever. He told the Washington Post in 1960 that despite the history of his family on both sides, he was not rich and in fact had attended Stanford on scholarship.

With the onset of the Korean War, Gavin was commissioned in the Navy, serving aboard the USS Princeton off Korea as an air intelligence officer from 1951 until the war’s end in 1953. Because of his fluency in Spanish and Portuguese, Gavin was assigned as flag lieutenant to Admiral Milton E. Miles until he completed his four-year tour of duty in 1955.

Gavin entered into an acting career in a roundabout way. Family friend Bryan Foy was making a movie about the aircraft carrier on which he’d served, and Gavin offered to serve as a technical adviser, but Foy instead arranged for Gavin to have a screen test at Universal. Gavin was reluctant, but his father urged him on. After a successful test, the studio signed Gavin to a contract; he later told the Los Angeles Times that “they offered me so much money I couldn’t resist.”

He made his debut in the 1956 Western “Raw Edge,” billed as John Gilmore; on his next film, crime drama “Behind the High Wall,” he was billed as John Golenor. The young actor was finally billed as John Gavin on this third film, “Four Girls in Town.” The Western “Quantez” was a step up, as it starred Fred MacMurray and Dorothy Malone.

With his role in Douglas Sirk’s 1958 film “A Time to Love and a Time to Die” Gavin began the period of a few years in which he had a high profile in Hollywood.

Gavin began serving on the board of the Screen Actors Guild in 1965. He served one term as third vice president, and two terms as first VP. He was president from 1971 to 1973. The SAG website says that while he was president, “He testified before the Federal Trade Commission on phony talent rackets; met with President Richard Nixon to present the problem of excessive television reruns; presented petitions to the federal government on issues of prime-time access rules, legislative assistance for American motion pictures (to combat runaway production), and film production by the government using non-professional actors.”

The Los Angeles Times characterized U.S. Ambassador Gavin as an “activist envoy to Mexico” who “won praise in many circles for his handling of such issues as trade and illegal drug dealing as well as for speaking out against anti-American sentiment. But his candor and meetings with critics of the ruling party prompted accusations by Mexicans of meddling in the country’s domestic affairs.”

In 1991, the Republican mulled a run for the Senate, but decided against it.

Gavin was twice married, the first time to Cicely Evans from 1957-65.

He is survived by his wife, actress Constance Towers, two children and two step-children.