Larry Gelbart, the award-winning comedy writer best known for developing the landmark TV series “MASH,” co-writing the book for the hit Broadway musical “A Funny Thing Happened on the Way to the Forum” and co-writing the classic movie comedy “Tootsie,” died Friday morning. He was 81.

Gelbart, who was diagnosed with cancer in June, died at his home in Beverly Hills, said his wife, Pat.

Jack Lemmon once described the genial, quick-witted Gelbart as “one of the greatest writers of comedy to have graced the arts in this century.”

“Larry Gelbart was among the very best comedy writers ever produced in America,” said Mel Brooks, whose friendship with Gelbart dated to when they both wrote for Sid Caesar’s comedy-variety show “Caesar’s Hour” in the 1950s. Gelbart “had class, he had wit, he had style and grace. He was a marvelous writer who could do more with words than anybody I ever met,” Brooks said.

In a statement Friday, Woody Allen called Gelbart “the best comedy writer that I ever knew and one of the best guys.”

Said Carl Reiner, who had also known Gelbart since the “Caesar’s Hour” days when Reiner was a cast member: “The main thing about Larry, he was a comedy prodigy who developed into a national treasure. The man was one of the most gifted satirists who ever lived.”

For many, Gelbart is best remembered for his work on “MASH,” the long-running series whose blend of laughter and tragedy made TV history.

Set in the 4077th Mobile Army Surgical Hospital during the Korean War, TV’s “MASH” grew out of director Robert Altman’s hit 1970 movie written by Ring Lardner Jr., which was based on the 1968 novel by Richard Hooker (the pen name of Dr. Richard Hornberger, who had been a military surgeon in Korea).

Gelbart and his family were living in London, and he was producing the British TV show “The Marty Feldman Comedy Machine” in 1971 when producer-director Gene Reynolds called him about writing a pilot script for a TV series based on “MASH.”

In writing the pilot, Gelbart recalled in his 1998 memoir “Laughing Matters,” he knew that it “was going to have to be a whole lot more than funny. Funny was easy. How not to trivialize human suffering by trying to be comic about it, that was the challenge.”

“MASH” debuted on CBS in 1972, with Gelbart serving as executive script consultant. He and Reynolds were both executive producers of the show -- and shared Emmys -- when it won the award for outstanding comedy series in 1974.

Gelbart’s influence on “MASH,” Reynolds told the New York Times in 1989, was “seminal, basic and enormous.”

“Larry not only had the wit and the jokes,” Reynolds said, “he had a point of view. He not only had the ribald spirit, he had the sensibility to the premise -- the wastefulness of war.”

As for the regulation-breaking surgeon Hawkeye Pierce -- the lead character played by Alan Alda -- Gelbart told the New York Times, “I didn’t have to think of why he was saying what he said. He was saying what I felt. I mean, he is an idealized me.”

Hawkeye, he said, “is capable -- that is, at work, at what he does. He’s an idealist. He’s a romantic. Somebody who cares about himself and other people. He’s often frustrated by whatever particular system he finds himself fighting against.”

“MASH” ran for 11 years. But Gelbart’s involvement ended in 1976 after four years and 97 episodes. As he later told The Times, “After four years, I had given it my best, my worst and everything in between.”

In a statement Friday, Alda said: “Larry’s genius for writing changed my life because I got to speak his lines -- lines that were so good they’ll be with us for a long, long time; but his other genius -- his immense talent for being good company -- is a light that’s gone out and we’re all sitting here in the dark.”

Gelbart’s more than 60-year career began in radio during World War II when he was a 16-year-old student at Fairfax High School in Los Angeles.

He wrote for “Duffy’s Tavern” and radio shows starring Eddie Cantor, Joan Davis, Jack Paar, Jack Carson and Bob Hope, with whom he traveled overseas when Hope entertained the troops.

He moved into television with Hope in 1950 and spent the next few years writing for the comedian as well as for Red Buttons’ comedy-variety series.

In 1955, Gelbart joined the writing staff of “Caesar’s Hour,” Sid Caesar’s post-"Your Show of Shows” TV comedy-variety series, whose writers included Neil Simon.

In the writers’ room, as Reiner later told Time magazine, Gelbart “popped jokes like popcorn.”

Indeed, after Gelbart went to work for “Caesar’s Hour,” Hope contacted Caesar to say, “I’ll trade you two oil wells for one Gelbart.”

During his time on Caesar’s show, Gelbart shared three Emmy nominations for comedy writing -- in 1956, ’57 and ’58. Moving to Broadway in 1961, Gelbart bombed with the musical “The Conquering Hero,” for which he wrote the book. The show closed after eight performances.

But Gelbart returned to Broadway in triumph in 1962 with the hit Stephen Sondheim comedy musical “A Funny Thing Happened on the Way to the Forum.” Gelbart and Burt Shevelove wrote the book, which they based on the comedies of the ancient Roman playwright Plautus.

“Forum,” whose cast included Zero Mostel, ran on Broadway for more than two years and won a Tony Award for best musical, as well as a Tony for Gelbart as co-author.

Gelbart later wrote the 1976-78 Broadway comedy “Sly Fox,” his updated adaptation of Ben Jonson’s “Volpone”; the 1989 satirical comedy “Mastergate”; and the book for the 1989-92 Broadway comedy musical “City of Angels,” the Tony best musical winner for which Gelbart won a Tony for best book of a musical.

For films, he wrote the screenplay for “Neighbors” and co-wrote “The Notorious Landlady,” “The Wrong Box,” “Not With My Wife, You Don’t!,” “Movie Movie” and “Blame It on Rio.”

He also received an Oscar nomination for his screenplay for “Oh, God!,” the 1977 comedy starring George Burns and John Denver. And he shared a screenwriting Oscar nomination with Murray Schisgal and Don McGuire for “Tootsie,” the 1982 comedy starring Dustin Hoffman and Jessica Lange.

Among his other credits, he wrote the screenplays for the HBO movies “Barbarians at the Gate” (1993), “Weapons of Mass Distraction” (1997) and “And Starring Pancho Villa as Himself” (2003).

The son of Eastern European immigrants -- his barber father was from Latvia and his seamstress mother was from Poland -- Gelbart was born Feb. 25, 1928, in Chicago.

Growing up on Chicago’s West Side, he spoke only Yiddish until he was 4.

“My mother was extremely witty and caustic,” he told People magazine in 1998, “and my father knew more jokes than anyone I’ve ever known.”

In 1942, Gelbart’s family moved to Los Angeles, where his father’s Beverly Hills clientele included actors and agents.

Gelbart had his father to thank for the launch of his comedy writing career in 1944 at age 16.

One of his father’s show business customers was comedian Danny Thomas, who had a weekly segment playing a Walter Mitty-type character on “Maxwell House Coffee Time,” a radio show starring comedian Fanny Brice.

After Gelbart’s father boasted that his son had a gift for writing comedy, Thomas told him, “Have the kid write something and let’s see just how good he is.”

At the time, Gelbart recalled in his memoir, “my only real ‘gift’ was for showing off, doing imitations, putting together sketches, speeches, monologues at Fairfax High School.”

But he wrote a sample comedy sequence for Thomas, who showed it to the radio show’s head writer, and Gelbart suddenly had an after-school job writing comedy for “Maxwell House Coffee Time.”

He was an 18-year-old staff writer on radio’s popular “Duffy’s Tavern” when he received a postwar draft notice.

But his career was not sidelined by his military service: Assigned to Armed Forces Radio Service, he continued to live at home while writing for the star-studded AFRS variety show “Command Performance,” as well as continuing his other radio-writing jobs.

In December 2008, the still-professionally active Gelbart found himself the subject of an Internet hoax on the online bulletin board alt.obituaries, which reported that he was “gravely ill . . . from a massive stroke.”

He was fine, of course -- and in fine comedic fettle. Referring to his alleged pending demise, he e-mailed alt.obituaries: “Does that mean I can stop exercising?”

But ever the rewriter, Gelbart came up with another witty response in a brief chat with an inquiring Los Angeles Times reporter: “I was dead, but I’m better now.”

He continued writing until three weeks ago, his wife said.

Gelbart married Pat, a Broadway actress and singer known professionally as Patricia Marshall and the mother of three children from a former marriage, in 1956. They had two children, Adam and Becky.

In addition to his wife and two children, Gelbart is survived by his stepchildren, Gary and Paul Markowitz; six grandchildren; and two great-grandchildren.

dennis.mclellan@latimes.com