John Mahoney, a British-born character actor who won a Tony Award on Broadway and had roles in films including “Moonstruck,” “In the Line of Fire” and “Say Anything” but was best known as Kelsey Grammer’s father and the voice of common sense in the long-running NBC sitcom “Frasier,” died Sunday after being hospitalized in Chicago. He was 77.

His manager, Paul Martino, announced the death but did not provide a cause.

Mahoney, who came to the United States when he was 19, did not start acting until he was 37. He frequently appeared on stage with Chicago’s Steppenwolf Theater and in 1986 won a Tony for his performance in John Guare’s “The House of Blue Leaves,” playing a zookeeper with ambitions of becoming an actor.

After a decade of theatrical roles and secondary parts in film and television, Mahoney transformed a single appearance on “Cheers,” the sitcom that included Grammer as the pompous psychiatrist Frasier Crane, into a career-defining role.

When “Frasier” was spun off as a separate show in 1993, Grammer begged Mahoney to take the part of Martin Crane, Frasier’s father. When he read the script, Mahoney later recalled, he said, “God, yes! I’ll do this in a minute.”

“Frasier” became renowned for its literate scripts and sophisticated humor. It was taped before live audiences, which reminded Mahoney of the theater, his favorite acting venue.

His character was a widowed police officer who had left the force after being shot in the hip. Throughout the 11 seasons of “Frasier,” Mahoney carried a cane and walked with a limp.

He moved into his son’s well-appointed Seattle apartment, and his crotchety, blue-collar ways formed a comic contrast to the snooty manners of his Ivy League-educated sons, Frasier and Niles Crane, played by Grammer and David Hyde Pierce.

Martin Crane’s garishly striped green-and-gold easy chair, patched with duct tape, was a constant source of embarrassment to Frasier. Mahoney often supplied a dose of plain-spoken wisdom that punctured his sons’ cultural pretensions. His character had occasional romantic flings – and even got married late in the series – but his constant companion was his spirited and emotionally astute dog, Eddie.

“Frasier” won five consecutive Emmy Awards from 1994 to 1998 as television’s outstanding comedy series and received 37 Emmys in all, more than any other TV sitcom in history.

Mahoney appeared in all 263 episodes of “Frasier” from 1993 to 2004 and was nominated for two Emmy Awards as best supporting actor.

In 1991, two years before “Frasier” began, he acknowledged to The Washington Post that he was contentedly resigned to a career as a character actor. “I’m 50,” he said, “and I look it – my gray hair and my potbelly, and I’ve started to get a little bald.”

If Mahoney wasn’t considered a leading man, his versatility and everyman looks kept him in constant demand. He appeared in Norman Jewison’s “Moonstruck” in 1987 as an alcoholic college professor who tries to seduce Olympia Dukakis’s character, Rose.

“We could go to my apartment,” he tells her. “You could see how the other half lives.”

“I’m too old for you,” Rose says.

“I’m too old for me,” Mahoney replies. “That’s my predicament.”

In 1988, he portrayed Kid Gleason, a baseball manager in John Sayles’s “Eight Men Out” about the 1919 Black Sox betting scandal. A year later, he appeared in “Say Anything,” which he considered perhaps his finest screen role. He was the father of a teenage girl, played by Ione Skye, who falls for a lower-class boy, portrayed by John Cusack.

Seeking to give his daughter a better life, Mahoney ends up in prison after embezzling from the retirement home he ran.

In 1993, he played the head of the Secret Service and Clint Eastwood’s boss in the thriller “In the Line of Fire.”

Among the leading directors who were eager to cast Mahoney in films were Barry Levinson (”Tin Men” 1987), Roman Polanski (”Frantic,” 1988), Costa-Gavras (”Betrayed,” 1988) and the Coen brothers (”Barton Fink,” 1991, and “The Hudsucker Proxy,” 1994).

“I remember one time Barry Levinson talking to me,” Mahoney told The Post, “and saying, ‘Well, we’ll cast everybody else and what we can’t find anybody for we’ll give to you.’ And that’s both the joy and the liability of being a character actor.”

John Mahoney was born June 20, 1940, in Blackpool, England, and grew up in Manchester as one of eight children. His father was a baker with musical aspirations, his mother a homemaker.

Mahoney showed promise as an actor in his early teens, but he fell away from the stage before moving to the United States at 19. He came to Chicago, where a sister was living.

He joined the U.S. Army and quickly lost his British accent. He graduated in 1966 from Quincy University in Illinois and later received a master’s degree in English from Western Illinois University.

He worked as a hospital orderly, a college teacher and, for several years, as an editor of a medical journal in Chicago. At 37, he seemed to be at a dead end, “spending all my time at home, smoking and drinking a few beers,” he told the Chicago Tribune in 1996. “There was this deep-seated frustration. I knew that the only place I had ever been really happy was on stage.”

He began taking acting lessons at a theater company with actor William H. Macy and playwright David Mamet. Two years later, Mahoney was invited to join Chicago’s Steppenwolf Theater, where he worked alongside such acclaimed actors as John Malkovich, Joe Mantegna, Laurie Metcalf and Gary Sinise.

Mahoney never settled in Hollywood, always staying in a rented apartment while taping episodes of “Frasier.” He made his permanent home in Oak Park, Illinois, and appeared in at least one play a year in the Chicago area, as well as on stages in New York, Los Angeles and Ireland.

After “Frasier,” he had recurring roles on “Hot in Cleveland” as the love interest of Betty White and in the HBO drama “In Treatment,” playing a psychologically troubled business executive. He also had parts as a voice actor and was a commercial spokesman for Federal Express and Lincoln Mercury, among other companies.

Mahoney never married and had no children. A complete list of survivors could not be confirmed.

While struggling to become established as an actor in Chicago, Mahoney sold his furniture and books in order to pay the rent. He couldn’t afford a new car until he was 49. Even if success came late, he never doubted his career choice.

“I remember thinking: This is the second largest city in the United States and I’m a working actor in it,” he told Back Stage West in 2001. “And I just remember the great feeling of pride and joy it gave me. … I didn’t feel any fear, I didn’t feel any regret, I just felt full of joy, and I still do.”