James Garner, the wry and handsome leading man who slid seamlessly between television and the movies but was best known as the amiable gambler Bret Maverick in the 1950s western “Maverick” and the cranky sleuth Jim Rockford in the 1970s series “The Rockford Files,” died on Saturday night at his home in Los Angeles. He was 86.

His publicist, Jennifer Allen, said he died of natural causes.

He was a genuine star but as an actor something of a paradox: a lantern-jawed, brawny athlete whose physical appeal was both enhanced and undercut by a disarming wit. He appeared in more than 50 films, many of them dramas — but, as he established in one of his notable early performances, as a battle-shy naval officer in “The Americanization of Emily” (1964) and had shown before that in “Maverick” — he was most at home as an iconoclast, a flawed or unlikely hero.

An understated comic actor, he was especially adept at conveying life’s tiny bedevilments. One of his most memorable roles was as a perpetually flummoxed pitchman for Polaroid cameras in the late 1970s and early 1980s, in droll commercials in which he played a vexed husband and Mariette Hartley played his needling wife. They were so persuasive that Ms. Hartley had a shirt printed with the declaration “I am not Mrs. James Garner.”

His one Academy Award nomination was for the 1985 romantic comedy “Murphy’s Romance,” in which he played a small-town druggist who woos the new-in-town divorced mom (Sally Field) with a mixture of self-reliance, grouchy charm and lack of sympathy for fools.