Ian Holm, a virtuosic British actor celebrated for his performances in plays by Shakespeare and Harold Pinter and in movies from Sidney Lumet’s “Night Falls on Manhattan” to the “Lord of the Rings” and “Hobbit” trilogies, died Friday in London. He was 88.

Isabella Riggs, an employee of his agents, Markham, Froggatt & Irwin, confirmed that he died in a hospital. She said the cause was an illness related to Parkinson’s disease.

A character actor who eventually played leading roles, Holm had a kind of magical malleability, with a range that went from the sweet-tempered to the psychotic. In the theater, he ran the gamut of Shakespeare, from the high-spirited Prince Hal to the tormented King Lear, and he left his imprint on two roles in Pinter’s “The 亚洲游国际集团homecoming”: the sleek, entrepreneurial Lenny and his autocratic father, Max.

In films, Holm incarnated characters of diverse geographic origin and nature, including a tough New York cop in “Night Falls on Manhattan” (1996), a big-city negligence lawyer in Atom Egoyan’s “The Sweet Hereafter” (1997) and a bohemian genius manqué in the title role in Stanley Tucci’s “Joe Gould’s Secret” (2000).

Exploring the world of fantasy, he was a malfunctioning robot in Ridley Scott’s “Alien” (1979) and the hobbit Bilbo Baggins in “The Fellowship of the Ring” (2001) and “The Return of the King” (2003), from Peter Jackson’s “Lord of the Rings” trilogy, and Jackson’s subsequent “Hobbit” films.

Explaining his ability to immerse himself in such disparate characters, Holm said simply, “I’m a chameleon.” The transformation was emotional as well as physical, as he discovered new depths of compassion even in the most unlikely characters.

In 1993, overcoming a serious case of stage fright, he returned to the theater after an absence of more than 15 years to star in Pinter’s “Moonlight.” Four years later, he set himself the monumental challenge of “King Lear” at the National Theater in London. It brought him the Laurence Olivier Award as best actor. Playing Lear, he said, was “like climbing Everest with no oxygen.”

He is survived by Sophie de Stempel, his fourth wife; five children; and eight grandchildren, Riggs, of his agency, said.

Holm was knighted in 1998.

Mel Gussow is a New York Times writer.