Former president Bill Clinton said he would have walked to Annapolis from New York if he had to — anything to pay tribute to his longtime friend, Maryland Senate President Thomas V. Mike Miller Jr.

“I can’t think of any public servant I know anywhere that has done it as well or as long as this man we honor tonight,” Clinton said Thursday after surprising Miller (D-Calvert), 76, at an annual dinner for the state Senate’s past and present members. “Mike Miller, we love you.”

More than 250 people, including Gov. Larry Hogan (R), U.S. Sen. Chris Van Hollen (D-Md.) and U.S. Rep. Steny H. Hoyer (D-Md.), turned out to honor Miller, who is battling Stage 4 prostate cancer that has metastasized to his spine and pelvic area.

The larger-than-life Democratic lawmaker is undergoing chemotherapy treatments during the annual legislative session, and he has lost much of his hair and some of his energy. Doctors say the cancer may be containable, but there is no cure.

The relationship between Miller, the country’s longest continuously serving Senate president, and the 42nd U.S. president dates back three decades.

Clinton said Thursday night that he remembered the exact date the two met — August 18, 1987, a day before Clinton’s 41st birthday. At the time, he was serving as Arkansas governor. Miller — who had taken the helm of the Maryland Senate seven months earlier — was attending a national legislative conference in Little Rock.

“I’m talking to him for a couple of minutes, and I want to reach in my back pocket and make sure my billfold is still there,” said Clinton in a 16-minute speech that was part tribute and part roast.

Over the years, the senator held numerous fundraisers for Clinton, including one in Miller’s hometown of Clinton, Md. About 10 years after they met, the president said, he came to Annapolis at Miller’s request to talk about education.

Clinton said the two Democrats “just kind of always stayed in touch.”

The former president’s appearance in Annapolis was a shock to many in the audience. But not so much to Sen. Craig J. Zucker (D-Montgomery). Zucker said he knew P.J. Hogan, a former Democratic senator from Montgomery County who is president of the Society of Senates Past, was trying to pull off the surprise. He didn’t know it was a go until he saw bomb-sniffing dogs Thursday evening in the Senate garage.

“I think it was very touching and a good tribute, well deserved,” Zucker said. “I think it made his night. It made all of our nights.”

When it was his turn at the microphone, Miller was quintessentially himself, using rough slang to joke that he would speak briefly because he is on medication that requires him to use the bathroom frequently.

“I take pills . . . I gotta take water pills,” he said, while also discussing other drugs, including steroids, that have made his face swell and his hair fall out and made it difficult to sleep.

“This is a very serious event, I’m very honored to be here,” he said, to laughter from the audience. “But I’m so goddamn tired of hearing about that Mike Miller.”

On Friday, Miller presided over the daily legislative session from his high-backed leather chair in the Senate chamber. Fatigue has kept him from standing at the lectern some of the time this year.

He rose as the session ended, however, lashing out at education advocates who filed a lawsuit this week over education spending in Baltimore City and are planning a massive rally Monday night in Annapolis.

“We don’t respond to threats,” said Miller, who joined other Democratic legislative leaders this week to announce plans to significantly boost education funding to implement recommendations of the landmark Kirwan commission.

“People can file suit all they want. We’re not going to respond to lawsuits or mass rallies,” he said.

In the House on Friday, lawmakers advanced a bill that would ban plastic foam food cups and containers. The measure is expected to receive final approval next week. A Senate version of the bill was approved earlier this week.